【发布时间】:2017-02-15 22:29:38
【问题描述】:
我已经为 tensorflow 执行了pip install。
python命令行环境下,我试过的时候
import tensorflow as tf
我遇到了以下错误:
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import
我已经使用print numpy.__version__ 检查了我的numpy 版本。它显示"1.8.2"。那么,我现在该怎么办?谢谢!
【问题讨论】:
-
看来你需要升级 numpy.可能是
pip install --upgrade numpy -
是的,似乎不是特定于 tensorflow 的问题,仅供参考,stackoverflow.com/questions/33859531/…
-
我试过“pip install --upgrade numpy”。但它告诉我我已经安装了最新版本。
-
@ReadyOrNot 请尝试我的解决方案。
标签: python python-2.7 numpy runtime-error tensorflow