问题描述
我正在努力安装OpenCV以在Mac上使用Python http://www. jeffreythompson.org/blog/2013/08/22/update-installing-opencv-on-mac-mountain-lion/
I was working to install OpenCV to work with Python on my Machttp://www.jeffreythompson.org/blog/2013/08/22/update-installing-opencv-on-mac-mountain-lion/
我安装了所有东西,都没有问题,但是最后我遇到了有线问题,提到"OpenCV库"未连接
I got everything installed without problems, but by the end I got this wired problem mentioning that the "OpenCV library" is not connected
$ pkg-config --cflags opencv
-I/usr/local/include/opencv -I/usr/local/include
$ brew install opencv
Warning: opencv-2.4.6.1 already installed, it's just not linked
$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cv
>>> import cv
推荐答案
对于它的价值,我认为您只是错过了我的说明.您需要将以下行添加到主文件夹中的.bash_profile
文件中(如果该文件不存在,则创建它):
For what it's worth, I think you just missed a step in my instructions. You need to add the following line to your .bash_profile
file in your Home folder (or create it if the file doesn't exist):
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
在启动Python之前,请确保重新启动Terminal.
Be sure to restart Terminal before starting Python.
这篇关于在Mac上将Python与Open CV链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!