RuntimeError:模块根据API版本a编译,但此版本的numpy在ubuntu中是9

RuntimeError:模块根据API版本a编译,但此版本的numpy在ubuntu中是9,numpy,theano,Numpy,Theano,我刚安装了theano,但是 import numpy print numpy.version 这是输出 Theano version 0.7.0.dev-30cc6380863b08a3a90ecbe083ddfb629a56161d theano is installed in /home/sizhexi/theano/Theano/theano NumPy version 1.8.2 NumPy is installed in /usr/lib/python2.7/dist-packag

我刚安装了theano,但是

import numpy
print numpy.version
这是输出

Theano version 0.7.0.dev-30cc6380863b08a3a90ecbe083ddfb629a56161d
theano is installed in /home/sizhexi/theano/Theano/theano
NumPy version 1.8.2
NumPy is installed in /usr/lib/python2.7/dist-packages/numpy
Python version 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2]
nose version 1.3.1
RuntimeError: module compiled against API version a but this version of numpy is 9
terminate called after throwing an instance of 'std::runtime_error'
  what():  numpy failed to initialize
Aborted (core dumped)

如何解决这个问题?

python中的包管理有时很棘手。为了避免这些问题,我建议使用Anaconda,它是一个很好的python包和环境管理器(,和)

按照官方说明安装Anaconda,并选择默认值,将Anaconda添加到$PATH中,并使Anaconda成为默认的python解释器。然后打开终端并使用以下命令:

  • conda安装pip六鼻numpy scipy
  • pip安装theano
然后尝试使用anaconda运行脚本