我看过以前类似问题的答案,但找不到对我有效的答案。
我在TensorFlow工作了很长时间。目前正在试用Yolov4,它要求使用Tensorflow 2.3.0版本,所以我决定安装它。
Anaconda的最新版本是2.1.0,在我的电脑上运行得很好。因此,由于这还不够,我创建了一个新的环境,并安装了带有pip install tensorflow-gpu
的Tensorflow,它安装了2.3.0版本,看起来没有错误。
然后对于import tensorflow as tf
,我得到了这个错误。有什么想法可以解决这个问题吗?
>>> import tensorflow as tf
Traceback (most recent call last):
File "C:UsersmazatAnaconda3envstf23libsite-packagestensorflowpythonpywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:UsersmazatAnaconda3envstf23libsite-packagestensorflow__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:UsersmazatAnaconda3envstf23libsite-packagestensorflowpython__init__.py", line 40, in <module>
from tensorflow.python.eager import context
File "C:UsersmazatAnaconda3envstf23libsite-packagestensorflowpythoneagercontext.py", line 35, in <module>
from tensorflow.python import pywrap_tfe
File "C:UsersmazatAnaconda3envstf23libsite-packagestensorflowpythonpywrap_tfe.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:UsersmazatAnaconda3envstf23libsite-packagestensorflowpythonpywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:UsersmazatAnaconda3envstf23libsite-packagestensorflowpythonpywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: The specified module could not be found.
问题似乎是Visual Studio的Redistributable的旧版本。从这里开始的新版本,到目前为止似乎有效!
https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
我遇到了类似的问题,并更新了Visual Studio(https://visualstudio.microsoft.com/pt-br/downloads/)为我工作。