When I import tensorflow, the output error `ImportError: numpy.core.multiarray failed to import`
When I import tensorflow, the output error `ImportError: numpy.core.multiarray failed to import`
导入tensorflow时,输出错误ImportError: numpy.core.multiarray failed to import
详情见下:
>>> import tensorflow as tf
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x7
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x7
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
您需要重新安装numpy
- 检查
numpy
安装位置
>>> import numpy
>>> print numpy.__path__
['/usr/lib64/python2.7/site-packages/numpy']
- 删除目录
# rm -fr /usr/lib64/python2.7/site-packages/numpy
- re-install
# pip install numpy --upgrade --force
4.successfully 导入
>>> import tensorflow as tf
>>>
导入tensorflow时,输出错误ImportError: numpy.core.multiarray failed to import
详情见下:
>>> import tensorflow as tf
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x7
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x7
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
您需要重新安装numpy
- 检查
numpy
安装位置
>>> import numpy
>>> print numpy.__path__
['/usr/lib64/python2.7/site-packages/numpy']
- 删除目录
# rm -fr /usr/lib64/python2.7/site-packages/numpy
- re-install
# pip install numpy --upgrade --force
4.successfully 导入
>>> import tensorflow as tf
>>>