import tensorflow 报错 as tf ImportError: DLL load failed

tensorlflow的安装

win10使用

pip  install tensorflow

安装tensorflow时安装了好几次才成功,装着装着就断了,目前还没搞清楚原因,
不过最终还是成功了,这个方法是可行的 ,另外一台机子win7系统一次pip就成功了

环境说明

环境系统:win10
tensorflow:cpu version2.2.

tensorflow导入报错

import tensorflow as tf
#报错 ImportError: DLL load failed: 找不到指定的模块

详细报错信息如下

ImportError: Traceback (most recent call last):
  File "本机\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "本机\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "本机\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 "本机\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "本机\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。


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.

解决方法:下载VisualStudio 2019社区版安装即可
在这里插入图片描述
该方法 来源于一位博主文章
文中还提到了另一种方法,卸载某些库并重装,
详情见:win10上安装tensorflow时报错 ImportError: DLL load failed: 找不到指定的模块
本人试了该方法没有成功,可能跟我权限有关,公司电脑不具备管理员权限,卸载某些库的时候虽然successfully 但还出了一些红色的报错或者警告,有兴趣的可以再试试!

猜你喜欢

转载自blog.csdn.net/qq_35866846/article/details/106144748