国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

解決Tensorflow安裝成功,但在導入時報錯的問題

2020-02-15 21:48:50
字體:
來源:轉載
供稿:網友

在Mac上按照官網教程安裝成功tensor flow后,但在程序中導入時,仍然報錯,包括但不限于以下兩個錯誤。對于這種錯誤,原因主要在于Mac內默認的python庫比較老了,即便通過pip命令安裝了新的包,python也會默認導入默認位置的包。這時候需要做的就是刪除,有沖突的包,對于以下兩個錯誤,就是分別時numpy和six兩個包沖突了。

可以在python命令行環境下,通過numpy.version和six.version兩個命令查看當前版本,如果與預期的不一致,就可以刪掉。

可以通過numpy.path查看默認包的位置。

刪掉即可

import tensorflow
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9 Traceback (most recent call last): File “”, line 1, in File “/Library/Python/2.7/site-packages/tensorflow/init.py”, line 24, in from tensorflow.python import * File “/Library/Python/2.7/site-packages/tensorflow/python/init.py”, line 49, in from tensorflow.python import pywrap_tensorflow File “/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py”, line 52, in raise ImportError(msg) ImportError: Traceback (most recent call last): File “/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py”, line 41, in from tensorflow.python.pywrap_tensorflow_internal import * File “/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py”, line 28, in _pywrap_tensorflow_internal = swig_import_helper() File “/Library/Python/2.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.Traceback (most recent call last): File “”, line 1, in File “/Library/Python/2.7/site-packages/tensorflow/init.py”, line 24, in from tensorflow.python import * File “/Library/Python/2.7/site-packages/tensorflow/python/init.py”, line 104, in from tensorflow.python.platform import test File “/Library/Python/2.7/site-packages/tensorflow/python/platform/test.py”, line 41, in from tensorflow.python.framework import test_util as _test_util File “/Library/Python/2.7/site-packages/tensorflow/python/framework/test_util.py”, line 54, in from tensorflow.python.platform import googletest File “/Library/Python/2.7/site-packages/tensorflow/python/platform/googletest.py”, line 35, in from tensorflow.python.platform import benchmark File “/Library/Python/2.7/site-packages/tensorflow/python/platform/benchmark.py”, line 120, in class Benchmark(six.with_metaclass(_BenchmarkRegistrar, object)): File “/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.py”, line 566, in with_metaclass return meta(“NewBase”, bases, {}) File “/Library/Python/2.7/site-packages/tensorflow/python/platform/benchmark.py”, line 115, in new if not newclass.is_abstract(): AttributeError: type object ‘NewBase' has no attribute ‘is_abstract' import tensorflow Traceback (most recent call last): File “”, line 1, in File “/Library/Python/2.7/site-packages/tensorflow/init.py”, line 24, in from tensorflow.python import * File “/Library/Python/2.7/site-packages/tensorflow/python/init.py”, line 49, in from tensorflow.python import pywrap_tensorflow ImportError: cannot import name pywrap_tensorflow            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 民权县| 固始县| 昌图县| 阿尔山市| 徐州市| 綦江县| 汪清县| 江油市| 武鸣县| 如皋市| 眉山市| 嵊泗县| 当雄县| 讷河市| 柳林县| 开平市| 乃东县| 南木林县| 乌拉特后旗| 延吉市| 香格里拉县| 宣武区| 丰县| 祥云县| 绥德县| 中超| 越西县| 确山县| 廊坊市| 洞口县| 和林格尔县| 田林县| 曲阳县| 竹溪县| 菏泽市| 嘉兴市| 拜城县| 醴陵市| 依兰县| 上饶县| 新闻|