在Windows 10和Python 3.8.3上。我使用
安装了TensorFlowpip install tensorflow==2.0.0
,但出现以下错误。关于如何解决此问题的任何建议?
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
63 try:
---> 64 from tensorflow.python._pywrap_tensorflow_internal import *
65 # This try catch logic is because there is no bazel equivalent for py_extension.
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:
ImportError Traceback (most recent call last)
<ipython-input-17-07ec96d933aa> in <module>
3 import matplotlib as mpl
4 import sklearn
----> 5 import tensorflow as tf
6 from tensorflow import keras
~\AppData\Roaming\Python\Python38\site-packages\tensorflow\__init__.py in <module>
39 import sys as _sys
40
---> 41 from tensorflow.python.tools import module_util as _module_util
42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
43
~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\__init__.py in <module>
38 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
39
---> 40 from tensorflow.python.eager import context
41
42 # pylint: enable=wildcard-import
~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\eager\context.py in <module>
33 from tensorflow.core.protobuf import config_pb2
34 from tensorflow.core.protobuf import rewriter_config_pb2
---> 35 from tensorflow.python import pywrap_tfe
36 from tensorflow.python import tf2
37 from tensorflow.python.client import pywrap_tf_session
~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\pywrap_tfe.py in <module>
26
27 # pylint: disable=invalid-import-order,g-bad-import-order, wildcard-import, unused-import
---> 28 from tensorflow.python import pywrap_tensorflow
29 from tensorflow.python._pywrap_tfe import *
~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
81 for some common reasons and solutions. Include the entire stack trace
82 above this error message when asking for help.""" % traceback.format_exc()
---> 83 raise ImportError(msg)
84
85 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long
ImportError: Traceback (most recent call last):
File "C:\Users\sunel\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
Failed to load the native TensorFlow runtime.
答案 0 :(得分:0)
Python 3.8 支持从 TensorFlow 2.2 或更高版本开始。因此,您面临上述问题。
您可以使用 pip install tensorflow
安装最新版本的 Tensorflow。 TensorFlow 2 软件包需要 pip version > 19.0
。
您需要从 here 下载并安装/更新 Microsoft Visual C++ 2015-2019 Redistributable (x64)。
如果您仍然面临 DLL 加载失败错误,可能的原因是
有关详细信息,请参阅here。