Python,Anaconda,Mac上的pybrain

时间:2014-10-16 19:41:09

标签: python anaconda pybrain

我安装了anaconda,但我也使用了pip:

$ conda list scipy
# packages in environment at /Users/bjelline/anaconda:
#
scipy                     0.14.0               np19py27_0  
$ conda list pybrain
# packages in environment at /Users/bjelline/anaconda:
#
pybrain                   0.3                       <pip>

这两个应该一起工作,不是吗? 当我做的时候

/Users/bjelline/anaconda/bin/python -c "import pybrain"

我收到错误:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/bjelline/anaconda/lib/python2.7/site-packages/pybrain/__init__.py", line 1, in <module>
    from structure.__init__ import *
  File "/Users/bjelline/anaconda/lib/python2.7/site-packages/pybrain/structure/__init__.py", line 1, in <module>
    from connections.__init__ import *
  File "/Users/bjelline/anaconda/lib/python2.7/site-packages/pybrain/structure/connections/__init__.py", line 1, in <module>
    from full import FullConnection
  File "/Users/bjelline/anaconda/lib/python2.7/site-packages/pybrain/structure/connections/full.py", line 3, in <module>
    from scipy import reshape, dot, outer
ImportError: cannot import name reshape

任何想法可能是什么问题?

2 个答案:

答案 0 :(得分:2)

问题不是anaconda,python或pip。问题是名为

的文件
pybrain.py

scipy.py

在当前目录中。当前目录在sys.path中是第一个,因此加载了这些文件而不是真正的库。

自我注意:永远不要将包名重用为您自己的文件名!

答案 1 :(得分:0)

试试conda install -f scipy。这将迫使重新安装scipy。