Python Mac的TensorFlow:导入TensorFlow时出错
我正试图在我的Mac上使用TensorFlow 我在终端中,一直遵循Tensorflow安装页面上的所有指示,直到“运行一个简短的测试程序” 我正在尝试写作Python Mac的TensorFlow:导入TensorFlow时出错,python,macos,tensorflow,machine-learning,importerror,Python,Macos,Tensorflow,Machine Learning,Importerror,我正试图在我的Mac上使用TensorFlow 我在终端中,一直遵循Tensorflow安装页面上的所有指示,直到“运行一个简短的测试程序” 我正在尝试写作 import tensorflow as tf 但我收到了以下信息 RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9 Traceback (most recent call last): File "<st
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 "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Users/robilin/Library/Python/2.7/lib/python/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.
RuntimeError:根据API版本0xa编译模块,但此版本的numpy是0x9
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/Users/robilin/Library/Python/2.7/lib/Python/site packages/tensorflow/_init__.py”,第24行,在
从tensorflow.python导入*
文件“/Users/robilin/Library/Python/2.7/lib/Python/site packages/tensorflow/Python/_init__.py”,第51行,在
从tensorflow.python导入pywrap\u tensorflow
文件“/Users/robilin/Library/Python/2.7/lib/Python/site packages/tensorflow/Python/pywrap_tensorflow.py”,第52行,在
提高效率(msg)
ImportError:回溯(最近一次呼叫上次):
文件“/Users/robilin/Library/Python/2.7/lib/Python/site packages/tensorflow/Python/pywrap_tensorflow.py”,第41行,在
从tensorflow.python.pywrap\u tensorflow\u内部导入*
文件“/Users/robilin/Library/Python/2.7/lib/Python/site packages/tensorflow/Python/pywrap\u tensorflow\u internal.py”,第28行,在
_pywrap\u tensorflow\u internal=swig\u import\u helper()
swig\u import\u helper中的文件“/Users/robilin/Library/Python/2.7/lib/Python/site packages/tensorflow/Python/pywrap\u tensorflow\u internal.py”,第24行
_mod=imp.load_模块(“pywrap_tensorflow_internal”,fp,路径名,描述)
ImportError:numpy.core.multiarray导入失败
未能加载本机TensorFlow运行时。
任何帮助都会很好 您似乎有一个不兼容的numpy版本 您需要升级numpy才能运行
pip install --upgrade numpy
要将numpy升级到其最新版本,请格式化您的异常,以便其他人可以阅读