0

我刚刚在 Imac Os 10.6.8 上安装了 Enthought Canopy。当我尝试测试 sklearn 时,我收到一条错误消息(附加在下面)。错误是 ImportError: numpy.core.multiarray failed to import。看起来使用了错误版本的 numpy。我不确定如何解决。

富有的

mu51220:~ rscherl$ python Enthought Canopy Python 2.7.3 | 32 位 | (默认,2013 年 6 月 14 日,18:24:40)[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin 输入“帮助”、“版权”、“信用”或“许可”以获取更多信息信息。

从 sklearn 导入数据集 /Library/Python/2.6/site-packages/numpy/random/init .py:87: RuntimeWarning:模块“mtrand”的编译时版本 2.6 与来自 mtrand 导入的运行时版本 2.7 不匹配 * RuntimeError:针对编译的模块API 版本 7,但此版本的 numpy 是 6 Traceback(最近一次调用最后一次):文件“”,第 1 行,在文件“/Users/rscherl/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages /sklearn/初始化.py”,第 32 行,从 .base 导入克隆文件“/Users/rscherl/Library/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/sklearn/base.py”,第 10 行,从scipy 导入稀疏文件“/Users/rscherl/Library/Enthought/Canopy_32bit/System/lib/python2.7/site-packages/scipy/sparse/init .py ”,第 182 行,从 .csr 导入 * 文件“/Users /rscherl/Library/Enthought/Canopy_32bit/System/lib/python2.7/site-packages/scipy/sparse/csr.py”,第 15 行,从 .sparsetools 导入 csr_tocsc、csr_tobsr、csr_count_blocks、\文件“/Users/ rscherl/Library/Enthought/Canopy_32bit/System/lib/python2.7/site-packages/scipy/sparse/sparsetools/ init.py”,第 5 行,从 .csr 导入 * 文件“/Users/rscherl/Library/Enthought/Canopy_32bit/System/lib/python2.7/site-packages/scipy/sparse/sparsetools/csr.py”,行26,在 _csr = swig_import_helper() 文件“/Users/rscherl/Library/Enthought/Canopy_32bit/System/lib/python2.7/site-packages/scipy/sparse/sparsetools/csr.py”,第 22 行,在 swig_import_helper _mod = imp.load_module('_csr', fp, pathname, description) ImportError: numpy.core.multiarray failed to import

4

1 回答 1

0

我发现我在我的 PYTHONPATH (在我的 .profile 中定义)/Library/Python/2.6/site-packages 从中获取了错误版本的 numpy。消除这一点可以解决问题。

于 2013-08-22T00:53:05.703 回答