Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building OpenCV libraries from source files

I have installed Python 2.7, but when I try to generate the OpenCV 2.3.1 project Makefiles using CMake 2.8, I get the following message. I am running Windows 7 x86 and using Visual Studio 10.

Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE) 
Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) 

I have followed the guide provided at this link.

like image 637
Saad Avatar asked Feb 02 '12 20:02

Saad


People also ask

How do I import my cv2 library?

Start the Python shell by typing python3 and then hit enter. You will be inside the Python shell where you can execute your Python code. Import the cv2 package which is the name of the OpenCV module. Type “import cv2” and hit enter.

Where OpenCV libraries are installed?

By default OpenCV will be installed to the /usr/local directory, all files will be copied to following locations: /usr/local/bin - executable files. /usr/local/lib - libraries (.


3 Answers

Yes, this also worked for me.

Check advanced, then manually set the values for the three variables.

In my case:

PYTHON_EXECUTABLE = .../python.exe

PYTHON_INCLUDE_DIR = .../include

PYTHON_LIBRARY = .../python26.lib

Tested with PythonPortable on Windows. (so, no installation required)

like image 198
ala Avatar answered Sep 23 '22 10:09

ala


Did you install Python in the normal place ( c:\Python2.7 on windows)

Use the Cmake-gui select advanced and it will allow you to set all the values directly

like image 31
Martin Beckett Avatar answered Sep 23 '22 10:09

Martin Beckett


Check the architecture of your installed Python, in my case for example I had Python x86_64 package installed but Cmake was looking for x86. So I believe this Cmake error message has a great potential of improvement.

like image 37
Baris Demiray Avatar answered Sep 23 '22 10:09

Baris Demiray