开发者

Setup OpenCV 2.3 w/ python bindings in ubuntu

开发者 https://www.devze.com 2023-04-10 17:28 出处:网络
How to install OpenCV (exactly 2.3.*, not 2.1.*) with python bindings in Ubuntu (or generally, in Linux)? I\'ve seen few manuals on Windows installations, but none for Linux.

How to install OpenCV (exactly 2.3.*, not 2.1.*) with python bindings in Ubuntu (or generally, in Linux)? I've seen few manuals on Windows installations, but none for Linux. I've read and used instructions from willow garage site:

wget downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2
tar -xvf OpenCV-2.3.1a.tar.bz2
cd OpenCV-2.3开发者_StackOverflow社区.1/
mkdir release
cd release
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..
make
sudo make install

All seems to be ok, except that make install output does not mention python. After that I'm trying to import opencv module in python REPL:

~$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy # so numpy is installed
>>> import cv
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cv
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cv2

What am I doing wrong?


Have you installed the Python development headers?

sudo apt-get install python-dev

Recompile it with those installed.

0

精彩评论

暂无评论...
验证码 换一张
取 消