国产探花免费观看_亚洲丰满少妇自慰呻吟_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            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 潞西市| 庆城县| 阜康市| 杭锦旗| 平度市| 西平县| 双鸭山市| 汤阴县| 大兴区| 乳山市| 延吉市| 温泉县| 仁布县| 常熟市| 武平县| 临朐县| 佳木斯市| 保定市| 屏东县| 德阳市| 佛山市| 阿坝| 镇平县| 高台县| 三门峡市| 故城县| 龙山县| 蒲城县| 龙岩市| 应城市| 禄丰县| 福建省| 双峰县| 龙山县| 南乐县| 建瓯市| 洪湖市| 新绛县| 肃南| 哈尔滨市| 札达县|