gpt4 book ai didi

Windows 上的 TensorFlow : ImportError: No module named '_pywrap_tensorflow_internal'

转载 作者:行者123 更新时间:2023-12-03 08:25:34 24 4
gpt4 key购买 nike

我正在尝试让 TensorFlow 在 Windows 上运行。但是在安装 Python 3.5 和 TensorFlow 后,我在导入 TensorFlow 模块时不断收到以下错误:

>>>import tensorflow
Traceback (most recent call last):
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\site-packages\
tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper

return importlib.import_module(mname)
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\importlib\__in
it__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: %1 is not a valid Win32 application.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\site-packages\
tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\site-packages\
tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\site-packages\
tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper

return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\importlib\__in
it__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: 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\amit\AppData\Local\Programs\Python\Python35\lib\site-packages\
tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\site-packages\
tensorflow\python\__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\site-packages\
tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\site-packages\
tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper

"return importlib.import_module(mname)"
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\importlib\__in
it__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: %1 is not a valid Win32 application.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\site-packages\
tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\site-packages\
tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\site-packages\
tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper

return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\amit\AppData\Local\Programs\Python\Python35\lib\importlib\__in
it__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

请提出我所缺少的内容,以便可以删除上述运行时错误。

最佳答案

当找不到 TensorFlow 所依赖的库 (DLL) 之一时,会出现此错误。为了诊断这种错误,我编写了一个脚本,您可以下载 from here ;运行该脚本将打印有关采取哪些步骤来修复错误的建议。

  • 如果您正在运行仅 CPU 版本的 TensorFlow,最有可能丢失的 DLL 是 MSVCP140.DLL .它是 Microsoft Visual C++ Redistributable Update 3 的一部分,您可以从 here 下载。 .
  • 如果您运行的是 GPU 版本的 TensorFlow,则可能找不到 CUDA 库或 cuDNN 库。 Windows 上的 TensorFlow 支持 CUDA 8.0(从 here 下载)和 cuDNN 5.1(从 here 下载)。请注意,cuDNN 通常安装在与 CUDA 不同的目录中,您可能需要手动将其添加到您的 %PATH% 中。环境变量。
  • 关于Windows 上的 TensorFlow : ImportError: No module named '_pywrap_tensorflow_internal' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43751418/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com