fatal error :"python.h" no file or directory?
For Ubuntu 15.10 and Python 3:
sudo apt-get install python-dev
sudo apt-get install python3-dev
sudo apt-get install libpython3-dev
sudo apt-get install libpython3.4-dev
sudo apt-get install libpython3.5-dev
After looking at https://github.com/hrldcpr/hungarian/blob/master/hungarian.cpp, it seems that you need both:
#include "Python.h"
#include "numpy/arrayobject.h"
So install the following packages:
sudo apt-get install libpython2.7-dev python-numpy
To identify the missing packages (the ones providing the headers), look at packages.ubuntu.com.
This is python code extending with C. No need to use make
. Python itself will take care of the cpp
code compilation with proper flags.
First you need to have header files and a static library. Install those as,
sudo apt-get install python-dev
Now follow these commands to execute example.py
in your code.
python setup.py build
cp build/lib.linux-i686-2.7/hungarian.so .
python example.py
Note: I am using
python2.7
, you should take care of your version of python when execute the above commands. It is worth mentioning that you need to installpython-numpy
if you not have it as python script need it.