Tensorflow错误:ImportError:DLL加载失败:找不到指定的模块

时间:2020-07-30 16:50:42

标签: python tensorflow anaconda tensorflow2.0 yolo

我已经浏览了以前对类似问题的答案,但找不到适合我的答案。

我已经使用TensorFlow很长时间了。目前正在试用需要使用Tensorflow版本2.3.0的Yolov4,因此我决定安装该版本。

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:\Users\mazat\Anaconda3\envs\tf23\lib\site-packages\tensorflow\python\pywrap_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:\Users\mazat\Anaconda3\envs\tf23\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\mazat\Anaconda3\envs\tf23\lib\site-packages\tensorflow\python\__init__.py", line 40, in <module>
    from tensorflow.python.eager import context
  File "C:\Users\mazat\Anaconda3\envs\tf23\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>
    from tensorflow.python import pywrap_tfe
  File "C:\Users\mazat\Anaconda3\envs\tf23\lib\site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\mazat\Anaconda3\envs\tf23\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\mazat\Anaconda3\envs\tf23\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: The specified module could not be found.

2 个答案:

答案 0 :(得分:2)

问题似乎出在Visual Studio的Redistributable的旧版本上。 使用此处的新版本,到目前为止,它似乎可以正常工作!

https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

答案 1 :(得分:0)

我遇到了类似的问题,因此更新Visual Studio(https://visualstudio.microsoft.com/pt-br/downloads/)对我有用。