Arnaud Aliès
Arnaud Aliès

Reputation: 1092

Python.h on windows with MinGW

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?

Upvotes: 2

Views: 6133

Answers (4)

Techniquab
Techniquab

Reputation: 913

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"

Upvotes: 1

Rohit J
Rohit J

Reputation: 1

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.

Upvotes: 0

Alan SlipKnot
Alan SlipKnot

Reputation: 1

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.

Upvotes: 0

J X
J X

Reputation: 55

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

Upvotes: 0

Related Questions