I and trying to build something on python package cv2. My os is Mac OS X El Capitan and python version is python 2.7.10.
我试图在python包cv2上构建一些东西。我的os是Mac os X El Capitan, python版本是python 2.7.10。
But when I import cv2 as
但是当我导入cv2时
>>> import cv2
I get following error.
我得到以下错误。
RuntimeError: module compiled against API version a but this version of numpy is 9
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import
I figured out that it is a problem of numpy version and I need to upgrade it. So I tried
我发现这是numpy版本的问题,我需要升级它。所以我试着
sudo pip install numpy --upgrade
But system threw following error:
但系统出现了以下错误:
OSError: [Errno 1] Operation not permitted: '/tmp/pip-JSOF8d-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'
Then I tried to install a particular version of numpy (required version) using following command.
然后我尝试使用以下命令安装一个特定版本的numpy(必需的版本)。
pip install numpy==1.8
Even this didn't work and I got following traceback error:
即使这样也不行,我得到了如下回溯错误:
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
Now I am clueless, how to proceed. Please help me to figure this out.
现在我一筹莫展,该怎么办呢?请帮我弄明白。
Thanks in advance.
提前谢谢。
1 个解决方案
#1
0
I was also facing the same issue, 2 things which solved my problem are
我也面临着同样的问题,有两件事解决了我的问题
-
Run
运行
pip install --ignore-installed numpy
pip安装——ignore-installed numpy
-
run the above command in terminal, that is don't use setuptools.
在终端上运行上述命令,即不使用setuptools。
But, it will upgrade to latest version of numpy, hope this resolves your problem. Its been quite tough for me to fix couple of el-capitan issues
但是,它将升级到最新版本的numpy,希望这能解决您的问题。对我来说,要解决几个大写字母的问题是相当困难的
#1
0
I was also facing the same issue, 2 things which solved my problem are
我也面临着同样的问题,有两件事解决了我的问题
-
Run
运行
pip install --ignore-installed numpy
pip安装——ignore-installed numpy
-
run the above command in terminal, that is don't use setuptools.
在终端上运行上述命令,即不使用setuptools。
But, it will upgrade to latest version of numpy, hope this resolves your problem. Its been quite tough for me to fix couple of el-capitan issues
但是,它将升级到最新版本的numpy,希望这能解决您的问题。对我来说,要解决几个大写字母的问题是相当困难的