简体   繁体   中英

Tensorflow Error: ImportError: DLL load failed: The specified module could not be found

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

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

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.

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

I had a similar problem and update Visual Studio ( https://visualstudio.microsoft.com/pt-br/downloads/ ) worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM