1

I have a issue when importing Python.h in a C code

No such file or directory

I m on windows 7 64 bits with codeblocks IDE MinGW compiler

please can someone help me with installing python c librarie?

Arnaud Aliès
  • 1,079
  • 13
  • 26
  • May help: [Link to Python with MinGW](http://stackoverflow.com/questions/6731100/link-to-python-with-mingw). Also: [How do I create Python extensions?](http://www.mingw.org/wiki/Python_extensions) – Pedro Romano Nov 04 '12 at 13:00

4 Answers4

1

With WinPython and gcc: add -I"[WinPythonFolder]\[python-ver.amd64]\include

eg:

 gcc read_wfm_wrap.c -I"C:\Python\WinPython-64bit-3.6.3.0Qt5\python-3.6.3.amd64\include"
Techniquab
  • 843
  • 7
  • 22
0

open Project -> Build Options -> Search Directories and add path where python.h resides

J X
  • 55
  • 5
0

In code::blocks just go to the Project tab. Then you open Build Options > Search Directories' and clickAdd`.

You then browse to the directory of your python installation and select the include folder (or copy-paste the include folder to your project folder and add that folder itself to the list).

Select not to keep relative path.

That definitely fixes the problem and a similar solution should be used for other IDEs.

Jason
  • 3,330
  • 1
  • 33
  • 38
0

Usually, Python.h and all the header files it includes in it resides in include folder of Python's installation directory. You could just copy either all the header files from Python's include folder C:\Py\Anaconda3\include to gcc|cl 's include folder (Mine looks like this, C:\Program Files (x86)\CodeBlocks\MinGW\include) or only to the point where header files dependencies are resolved.

IKavanagh
  • 6,089
  • 11
  • 42
  • 47
Rohit J
  • 1
  • 1