欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

安装pybrain遇到的问题。

程序员文章站 2022-05-29 08:19:35
...

1,要先安装Scipy模块,numpy模块,nose模块这三个模块。这几个直接pip install 安装就行。
2,直接用pip install pybrain安装,import pybrain的时候,报错如下:

Traceback (most recent call last):
  File "C:/Users/Marcus/PycharmProjects/ANN/ann.py", line 2, in <module>
    from pybrain.tools.shortcuts import buildNetwork
  File "C:\Python34\lib\site-packages\pybrain\__init__.py", line 1, in <module>
    from structure.__init__ import *
ImportError: No module named 'structure'

原因是因为pip默认安装的是pybrain的3.0版本,不是最新的。
解决:直接用pip install https://github.com/pybrain/pybrain/archive/0.3.3.zip命令安装。
参考:这里

3,按照步骤2做完之后,导入还是有如下报错:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\address\anaconda35\lib\site-packages\pybrain\__init__.py", line 1, in <module>
    from pybrain.structure.__init__ import *
  File "D:\address\anaconda35\lib\site-packages\pybrain\structure\__init__.py", line 2, in <module>
    from pybrain.structure.modules.__init__ import *
  File "D:\address\anaconda35\lib\site-packages\pybrain\structure\modules\__init__.py", line 2, in <module>
    from pybrain.structure.modules.gate import GateLayer, DoubleGateLayer, MultiplicationLayer, SwitchLayer
  File "D:\address\anaconda35\lib\site-packages\pybrain\structure\modules\gate.py", line 10, in <module>
    from pybrain.tools.functions import sigmoid, sigmoidPrime
  File "D:\address\anaconda35\lib\site-packages\pybrain\tools\functions.py", line 4, in <module>
    from scipy.linalg import inv, det, svd, logm, expm2
ImportError: cannot import name 'expm2'

解决办法:根据File "D:\address\anaconda35\lib\site-packages\pybrain\tools\functions.py", line 4, in <module>提示,找到functions.py的第四行,把expm2改为expm
参考:这里

相关标签: pybrain