我想开始使用tensorflow,每次我导入它,我看到这个错误。我通常也导入keras,但它会因为TensorFlow而崩溃。当我单独导入TensorFlow时,我也会看到这个错误
Traceback (most recent call last):
File "C:UsersUserAppDataLocalProgramsPythonPython39libsite-packagestensorflowpythonpywrap_tensorflow_internal.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
File "C:UsersUserAppDataLocalProgramsPythonPython39libimp.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:UsersUserAppDataLocalProgramsPythonPython39libsite-packagestensorflowpythonpywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:UsersUserAppDataLocalProgramsPythonPython39libsite-packagestensorflowpythonpywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:UsersUserAppDataLocalProgramsPythonPython39libsite-packagestensorflowpythonpywrap_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 "c:UsersUserDesktop mega.patchPythonPythonTests.py", line 1, in <module>
import tensorflow
File "C:UsersUserAppDataLocalProgramsPythonPython39libsite-packagestensorflow__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:UsersUserAppDataLocalProgramsPythonPython39libsite-packagestensorflowpython__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:UsersUserAppDataLocalProgramsPythonPython39libsite-packagestensorflowpythonpywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:UsersUserAppDataLocalProgramsPythonPython39libsite-packagestensorflowpythonpywrap_tensorflow_internal.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
File "C:UsersUserAppDataLocalProgramsPythonPython39libimp.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:UsersUserAppDataLocalProgramsPythonPython39libsite-packagestensorflowpythonpywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:UsersUserAppDataLocalProgramsPythonPython39libsite-packagestensorflowpythonpywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:UsersUserAppDataLocalProgramsPythonPython39libsite-packagestensorflowpythonpywrap_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/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
什么是">pywrap_tensorflow",为什么它不存在?有什么我能做的吗?提前谢谢
根据我的经验,pywrap_tensorflow
需要cuDNN
。请安装相应的cuDNN
安装cuDNN
之前,请检查CUDA
是否安装成功。执行命令nvcc -V
查看。