RuntimeError:针对API版本a编译的模块,但是这个版本的numpy在ubuntu中是9

use*_*624 5 numpy theano

我刚刚安装了theano,但是

import numpy
print numpy.version
Run Code Online (Sandbox Code Playgroud)

这是输出

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)
Run Code Online (Sandbox Code Playgroud)

怎么解决?

LeC*_*Gui 1

python 中的包管理有时很棘手。为了避免这些问题,我建议使用 Anaconda,它是一个很好的 python 包和环境管理器(在此处下载,以及30 分钟指南)。

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

  • conda install pip six nose numpy scipy
  • pip install theano

然后尝试使用 anaconda 运行脚本。