macos – fatal error: Python.h file not found while installing opencv

macos – fatal error: Python.h file not found while installing opencv

If Python.h is not found while making one of the *.cpp files, set the following ENV variable

export CPLUS_INCLUDE_PATH=/System/Library/Frameworks/Python.framework/Headers

Please check the existence of the path in your system and make sure that Python.h is there.

Im using El Capitan but I dont think there should be much difference in the path to the Python header. I find mine at:

/System/Library/Frameworks/Python.framework/Headers/Python.h

You could try and run:

export C_INCLUDE_PATH=/System/Library/Frameworks/Python.framework/Headers

then try the remaining steps.

macos – fatal error: Python.h file not found while installing opencv

Run

brew install python

or

brew upgrade python

after doing this, everything(vim in my case) you want to install will be success.

Leave a Reply

Your email address will not be published.