安装TensorFlow2.x版本,发现报找不到DLL的错误怎么办?ImportError: DLL load failed while importing _pywrap_tensorflow_in

报错内容:

Traceback (most recent call last):
File “C:\Anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\Anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\Anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 24, in swig_import_helper
_mod = imp.load_module(’_pywrap_tensorflow_internal’, fp, pathname, description)
File “C:\Anaconda\lib\imp.py”, line 242, in load_module
return load_dynamic(name, filename, file)
File “C:\Anaconda\lib\imp.py”, line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:/Users/Administrator/Desktop/123.py”, line 5, in
import tensorflow as tf
File “C:\Anaconda\lib\site-packages\tensorflow_init_.py”, line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Anaconda\lib\site-packages\tensorflow\python_init
.py", line 50, in
from tensorflow.python import pywrap_tensorflow
File “C:\Anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 69, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File “C:\Anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\Anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\Anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 24, in swig_import_helper
_mod = imp.load_module(’_pywrap_tensorflow_internal’, fp, pathname, description)
File “C:\Anaconda\lib\imp.py”, line 242, in load_module
return load_dynamic(name, filename, file)
File “C:\Anaconda\lib\imp.py”, line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 找不到指定的模块。

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

Process finished with exit code 1

解决办法:

这是电脑缺少Visual C++导致的,去这里下载:Visual C++下载网站
可能需要才能打开,如果是打不开,点击下方直接下载对应版本即可:
点击下载64位的Visual C++
点击下载32位的Visual C++
点击下载Linux的Visual C++
安装完成,再运行代码,会发现代码不再报这个错误了!

如果文章解决您多年未解之谜,请一键三连!

你可能感兴趣的:(tensorflow2.0,anaconda,conda,python,tensorflow,anaconda,深度学习,dll)