本文介绍了Tensorflow错误:ImportError:DLL加载失败:找不到指定的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've looked through previous answers to similar questions but couldn't find the answer that worked for me.

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

I've worked with TensorFlow for a long time. Currently trying out Yolov4 which has a requirement to use Tensorflow version 2.3.0, so I decided to install that one.

Anaconda的最新版本是2.1.0,可以在我的计算机上很好地运行.因此,由于这还不够,我创建了一个新环境,并使用 pip install tensorflow-gpu 安装了Tensorflow,该版本似乎安装了2.3.0版本.

Anaconda's latest release is 2.1.0 that works great on my computer. So since that was not enough, I created a new environment and installed Tensorflow with pip install tensorflow-gpu which installs version 2.3.0 seemingly without errors.

然后为 import tensorflow as tf 输入此错误.有什么想法可以尝试解决这个问题吗?

Then for the import tensorflow as tf I get this error. Any ideas what to try to resolve this?

>>> 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.

推荐答案

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

Looks like the problem was the old version of Redistributable for Visual Studio.With the new version from here, it seems to work thus far!

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

这篇关于Tensorflow错误:ImportError:DLL加载失败:找不到指定的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 19:59