在OSX上为numpy提供不同API版本的RuntimeError

时间:2016-09-16 13:58:54

标签: python macos python-2.7 pip

我想使用selectivesearch包,具体取决于scikit-image。

我使用pip2来安装这两个软件包。

$ pip2 install scikit-image
Requirement already satisfied (use --upgrade to upgrade): scikit-image in /usr/local/lib/python2.7/site-packages

$ pip2 install selectivesearch
Requirement already satisfied (use --upgrade to upgrade): selectivesearch in /Library/Python/2.7/site-packages/selectivesearch-0.3-py2.7.egg

scikit-image位于文件夹/usr/local/lib/python2.7/site-packages

selectivesearch位于文件夹/Library/Python/2.7/site-packages/

当我尝试导入selectivesearch时,解释程序会抱怨No module name skimage.io

>>> import selectivesearch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.9-intel/egg/selectivesearch/__init__.py", line 1, in <module>
  File "build/bdist.macosx-10.9-intel/egg/selectivesearch/selectivesearch.py", line 2, in <module>
ImportError: No module named skimage.io

然后我尝试将/usr/local/lib/python2.7/site-packages的路径添加到python系统路径

>>> import os
>>> os.sys.path.append("/usr/local/lib/python2.7/site-packages")

然后翻译抱怨RuntimeError: module compiled against API version 7 but this version of numpy is 6

以下是import skimage.data

时的完整错误日志
>>> import skimage.data
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/skimage/data/__init__.py", line 12, in <module>
    from ..io import imread, use_plugin
  File "/usr/local/lib/python2.7/site-packages/skimage/io/__init__.py", line 7, in <module>
    from .manage_plugins import *
  File "/usr/local/lib/python2.7/site-packages/skimage/io/manage_plugins.py", line 28, in <module>
    from .collection import imread_collection_wrapper
  File "/usr/local/lib/python2.7/site-packages/skimage/io/collection.py", line 14, in <module>
    from ..external.tifffile import TiffFile
  File "/usr/local/lib/python2.7/site-packages/skimage/external/tifffile/__init__.py", line 1, in <module>
    from .tifffile import imsave, imread, imshow, TiffFile, TiffWriter, TiffSequence
  File "/usr/local/lib/python2.7/site-packages/skimage/external/tifffile/tifffile.py", line 153, in <module>
    from . import _tifffile
RuntimeError: module compiled against API version 7 but this version of numpy is 6

我使用的是OSX 10.9

$ uname -a
Darwin LilideMacBook-Air.local 13.4.0 Darwin Kernel Version 13.4.0: Mon Jan 11 18:17:34 PST 2016; root:xnu-2422.115.15~1/RELEASE_X86_64 x86_64

0 个答案:

没有答案