我有mac os x 10.9。我使用自制软件下载了opencv-python,我在主python网站上都有python 2.7和python 3.4版本,用macs下载了常用的方法。我需要使用opencv,但他们没有mac的下载包所以我用的是自制软件:
brew tap homebrew/science
brew install opencv
当我在终端中输入python,然后输入import cv时,我收到分段错误,python意外退出。在IDLE中也会发生同样的事情。对于python 3.4,我得到一个无模块错误。这是:
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21)
[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>
File "/Users/aurora_alvarez-buylla/cv.py", line 1, in <module>
from cv2.cv import *
ImportError: No module named 'cv2'
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
Segmentation fault: 11
然后意外退出。有谁知道发生了什么?坦率地说,我在这个opencv问题上花费了太多时间,并且发现它非常令人沮丧。谢谢!
答案 0 :(得分:8)
Chris Muktar指出this thread问题是由系统Python和酿造的Python之间的冲突引起的。按照这个想法,我通过删除系统python并重新安装opencv来解决这个问题:
$ cd /usr/bin
$ sudo mv python python.bak
$ brew uninstall opencv
$ brew install opencv