aagaard
aagaard

Reputation: 1666

Building OpenCV 2.3.1 with Python 2.7 support in Ubuntu 11.10 64bit

I have seen a lot of posts on this topic, however I have not found regarding this warning:

CMake Warning:
   Manually-specified variables were not used by the project:

   BUILD_PYTHON_SUPPORT

when I compile with cmake. When building OpenCV with this warning, it turns out that it doesn't include python support (surprise).

I use this command to compile the build-files

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..

I have installed python-dev.

Upvotes: 7

Views: 8162

Answers (2)

Waqas
Waqas

Reputation: 3853

Simple instructions to install opencv with python bindings in Linux - Ubuntu/Fedora

  1. Install gcc, g++/gcc-c++, cmake (apt-get or yum, in case of yum use gcc-c++). #apt-get install gcc, g++, cmake
  2. Downlaod latest opencv from openCV's website (http://opencv.org/downloads.html).
  3. Untar it #tar - xvf opencv-*
  4. Inside the untarred folder make a new folder called "release" (or any folder name) and run this command in it #"cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON .." the ".." will pull files from the parents folder and will get the system ready for installation on your platform.
  5. in the release (#cd release) folder run #make
  6. After about 2-3 mins of make processing when its finished run #make install

That's it, now go to python and try ">>> import cv2" you should not get any error message.

Tested on python 2.7, should be virtually similar to python 3.x.

Upvotes: 3

mevatron
mevatron

Reputation: 14011

It looks like you're using an old install guide. Use BUILD_NEW_PYTHON_SUPPORT instead.

So, execute CMake like this:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..

Also, if you use the CMake GUI, it is easier to see all of the options you can set for OpenCV (there are so many it's quite tedious to type them all on the command-line). To get it for Ubuntu, do this:

sudo apt-get install cmake-qt-gui

Upvotes: 16

Related Questions