无法让Theano在ubuntu 14.04上工作

时间:2014-08-12 16:56:28

标签: python ubuntu numpy theano

我试图在ubuntu 14.04上使用Theano,我已经按照指南进行了简单的安装http://deeplearning.net/software/theano/install_ubuntu.html#install-ubuntu

如果我跑的话,一切都说它安装得很好:

sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git

然后我得到回报

Reading package lists... Done
Building dependency tree 
Reading state information... Done
g++ is already the newest version.
git is already the newest version.
python-dev is already the newest version.
python-nose is already the newest version.
python-numpy is already the newest version.
libopenblas-dev is already the newest version.
python-pip is already the newest version.
python-scipy is already the newest version.
0 to upgrade, 0 to newly install, 0 to remove and 18 not to upgrade.

运行时

sudo pip install Theano

我得到了

Requirement already satisfied (use --upgrade to upgrade): Theano in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.5.0 in ./.local/lib/python2.7/site-packages (from Theano)
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.7.2 in /usr/lib/python2.7/dist-packages (from Theano)
Cleaning up...

但是当我去参加测试时,他们只是不能工作。

python -c "import numpy; numpy.test()"

给了我

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/josh/.local/lib/python2.7/site-packages/numpy/__init__.py", line 153, in <module>
    from . import add_newdocs
  File "/home/josh/.local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/home/josh/.local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/home/josh/.local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/home/josh/.local/lib/python2.7/site-packages/numpy/core/__init__.py", line 6, in <module>
    from . import multiarray
ImportError: /home/josh/.local/lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS4_AsUnicodeEscapeString

python -c "import scipy; scipy.test()"

给了我

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named scipy

最后一次测试给出了非常相似的结果

josh@josh-GA-78LMT-S2P:~$ python -c "import theano; theano.test()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named theano

我是一个完整的Linux新手,所以我对可能出现的问题感到非常困惑。

1 个答案:

答案 0 :(得分:2)

如果可以,我会简单地使用“科学”Python - Anaconda(我的偏好)或Enthought Python。除了避免在系统范围内安装软件包之外,还可以轻松安装带有pip和numpy以及scipy的东西。为了更新numpy和scipy,你也可以使用内置的conda包管理器 - 它可以很好地处理安装新numpy或scipy背后的讨厌工作。