我正在尝试将pyopencv安装到使用--no-site-packages选项创建的virtualenv:
pip install pyopencv
但是我在Ubuntu 10.04.3上遇到以下错误:
CMake Error at CMakeLists.txt:186 (find_package):
Could not find a configuration file for package OpenCV.
Set OpenCV_DIR to the directory containing a CMake configuration file for
OpenCV. The file will have one of the following names:
OpenCVConfig.cmake
opencv-config.cmake
我已经安装了numpy,scipy和OpenCV(libboost-dev libboost-python1.40.0 libboost-python1.40-dev cmake libcv4 libcv-dev libcvaux4 libcvaux-dev)。有什么想法吗?
PS我知道有预先构建的Ubuntu软件包python-opencv,但我不知道如何使用--no-site-packages将它安装到virtualenv中(可能symlink会起作用,但它很丑... )。答案 0 :(得分:2)
将这两行添加到/etc/bash.bashrc(或者只是在命令提示符下运行)可以解决问题。
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
另请点击此处的说明:https://github.com/ingenuitas/SimpleCV#installation
答案 1 :(得分:1)
我认为你必须先安装openCV来构建python包装器。
答案 2 :(得分:1)
sudo apt-get build-dep python-opencv
实际上不会安装python-opencv,但它会安装pyopencv依赖的非Python包。我发现apt-get build-dep是在virtualenvs中使用pip的一个很棒的补充。
答案 3 :(得分:0)
Pip在您的路径中缺少opencv。
如果您尚未安装opencv,sudo apt-get install opencv
将解决此问题。
答案 4 :(得分:0)
here, try this, open /etc/ld.so.conf.d/opencv.conf as root with your favourite
editor say gedit and add this line to it /usr/local/lib
Reload configuration files created
sudo ldconfig
now open /etc/bash.bashrc and add this line
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
then copy these files as below
sudo cp /usr/local/lib/python2.7/site-packages/cv.so /usr/local/lib/python2.7/dist-packages/cv.so
And then try testing your openCV. HAPPY CODING