在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
以上这篇解决Tensorflow安装成功,但在导入时报错的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
标签:
Tensorflow,安装,导入
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
白云城资源网 Copyright www.dyhadc.com
暂无“解决Tensorflow安装成功,但在导入时报错的问题”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2025年01月11日
2025年01月11日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]