python - TensorFlow 导入错误
问题描述
我使用 pip install 安装了 Tensorflow 2.2.0,在 Python 3.8 中导入时遇到了一些问题。发生以下错误,我想知道如何解决此问题:
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Program Files\Python38\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Program Files\Python38\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/[name]/Downloads/AnomalyDetection/Paysim.py", line 2, in <module>
import tensorflow as tf
File "C:\Program Files\Python38\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Program Files\Python38\lib\site-packages\tensorflow\python\__init__.py", line 50, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Program Files\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Program Files\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Program Files\Python38\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Program Files\Python38\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
解决方案
推荐阅读
- numpy - 如何将填充 RGB 图像归零?
- powershell - 从 Msi 文件/SELECT * 从 msi 表/InvokeMember 中读取多个值,在 Powershell 中使用 5 个参数“OpenView、Sql”
- reactjs - 当 react 组件包含函数时 containsMatchingElement 返回 false
- javascript - 等待 $(document).ready、$(element).ready 和 windows.load 都在内容准备好之前触发
- c - 如何在Windows下使用cmake和MinGW编译C接口LAPACKE?
- javascript - 如何获取用户被重定向的页面
- laravel - 在 gonoware/laravel-maps 包中禁用滚动缩放
- python - ImportError:无法从“oauthlib.common”导入名称“bytes_type”
- java - 如何使用户在sql中更改表名
- python - 重用在 python 类中定义的变量