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 但還出了一些紅色的報錯或者警告,有興趣的可以再試試!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章