tensorflow - 当按下 import tensorflow 时,它显示以下错误
问题描述
当按下导入 tensorflow 时,它显示以下错误我有 tensorflow 1.5.0 版,我通过“python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow -1.5.0-py3-none-any.whl " bcz ntg 其他命令用于安装 tensorflow
Traceback (most recent call last):
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\riya\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
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.
解决方案
import tensorflow
问题已通过逐32
位更改 python 得到解决, 64
python 版本必须为 3.5-3.7,因为 3.8 不兼容通过pip install tensorflow==1.5.0
.
推荐阅读
- regex - 匹配匹配字符串的最后一个“:”的子字符串
- xamarin - 如何使用命令而不是事件使 TapGestureRecognizer 在我的类中调用方法?
- python - 我如何操作/修改现有的嵌套 python 字典“dict”并具有下面需要的输出格式?
- flutter - 当卡片被点击时,如何使 beer_ciders 类中的文本出现在订单类中
- openxml - 一个运行元素是否可能包含多个文本元素
- angular - PrimeNG 动态对话框 - 单击即可关闭
- plot - 如何布置可变数量的面板?
- c# - 如何将具有时间跨度节点的 XML 对象文件转换为 .NET Standard 中的 C# 类
- php - 如何在 PHP 中使用 simpleXML 删除重复值
- symfony - Symfony 如何将 Mercure 与 Messenger + RabbitMQ 一起使用?