簡體   English   中英

導入 tensorflow 時,出現錯誤“導入錯誤:DLL 加載失敗:找不到指定的模塊。”

[英]While importing tensorflow, got the error 'ImportError: DLL load failed: The specified module could not be found.'

我已經看到並實施了幾種可能的解決方案來解決我的問題,但似乎都沒有奏效。 能否解決導入 tensorflow 的錯誤?

版本--> python 3.7.4 --> tensorflow 2.3.0

runfile('C:/Users/pshad/.spyder-py3/temp.py', wdir='C:/Users/pshad/.spyder-py3') Traceback (most recent call last):

  File "<ipython-input-27-bc8fb4f78acd>", line 1, in <module>
    runfile('C:/Users/pshad/.spyder-py3/temp.py', wdir='C:/Users/pshad/.spyder-py3')

  File "C:\Users\pshad\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "C:\Users\pshad\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/pshad/.spyder-py3/temp.py", line 9, in <module>
    import tensorflow as tf

  File "C:\Users\pshad\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util

  File "C:\Users\pshad\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 40, in <module>
    from tensorflow.python.eager import context

  File "C:\Users\pshad\Anaconda3\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>
    from tensorflow.python import pywrap_tfe

  File "C:\Users\pshad\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow

  File "C:\Users\pshad\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
    raise ImportError(msg)

ImportError: Traceback (most recent call last):   File "C:\Users\pshad\Anaconda3\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.


Failed to load the native TensorFlow runtime.

Anaconda 提供了 Tensorflow 的安裝,它可以處理所有事情,包括所有 GPU 和 ZA33B7755E5F9B504DZEA2D 依賴項:

conda install -c anaconda tensorflow-gpu

它適用於 Tensorflow 2.1 和 Python 3.7。 當組件單獨安裝或通過 Anaconda 以外的其他渠道安裝時,DLL 故障很常見。

我認為 package 沒有正確安裝。 嘗試重新安裝它。(如果你使用'pip'安裝不要忘記更新它)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM