2015-12-01 46 views
5

我剛裝theano 9,但RuntimeError:編譯模塊對API版本,但這個版本numpy的是在Ubuntu

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) 

如何解決呢?

回答

1

python中的包管理有時很棘手。爲了避免這些問題,我推薦使用Anaconda這是一個很好的Python包和環境管理器(download here30 minutes guide)。

按照官方指示安裝Anaconda並選擇將Anaconda添加到您的$ PATH並使Anaconda成爲您的默認python解釋器的默認值。然後打開你的終端,並使用下面的命令:

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

然後嘗試使用anaconda運行腳本。