简体   繁体   English

编译和使用OpenCV

[英]Compiling and using OpenCV

I have install cmake version 2.8.12 and downloaded opencv-2.4.6.1 我已经安装了cmake版本2.8.12并下载了opencv-2.4.6.1

I then cd into the opencv-2.4.6.1 directory and run 然后我进入cd opencv-2.4.6.1目录并运行

$ cmake CMakeLists.txt 
$ make
$ sudo make install

Yet I cannot import cv2 in python. 但是我不能在python中导入cv2。 CMake, make, and make install run fine, what gives? CMake,make和make install运行良好,这有什么用?

I am running Mountain Lion with xCode developer tools installed and python 2.7.2 我正在安装xCode开发人员工具和python 2.7.2的情况下运行Mountain Lion

You need to copy compiled module from the build/python/2.X to the /Library/Python/2.X/site-packages/ folder. 您需要将编译后的模块从build/python/2.X复制到/Library/Python/2.X/site-packages/文件夹。

Also OpenCV needs to be compiled with same bitness as python. 另外,OpenCV需要以与python相同的位编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM