python - 导入tensorflow时出现错误 'ImportError: DLL load failed: The specified module could not be found.'

标签 python tensorflow import compiler-errors

我已经看到并实现了解决该问题的几种潜在解决方案,但似乎没有一个可行。
我可以为导入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和CUDA依赖项:

conda install -c anaconda tensorflow-gpu
它适用于Tensorflow 2.1和Python 3.7。当单独安装组件或通过Anaconda以外的其他 channel 安装组件时,DLL故障很常见。

关于python - 导入tensorflow时出现错误 'ImportError: DLL load failed: The specified module could not be found.',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63279533/

相关文章:

java - 如何在 Android Studio 中将 OpenCV Mat 输入帧转换为 Tensorflow 张量?

python - 使用 tf.optimizers.Adam.minimize() 时,对象不可调用

python - 将tensorflow BERT检查点转换为pytorch时出错

python - 拟合模型时如何在keras/tensorflow中使用多线程?

通过循环内的 CSS 选择器的 Python Selenium 驱动程序

python - 为什么这个自定义 json 编码器不起作用?

mysql - 导入 MySQL 转储文件时如何覆盖 ENGINE=INNODB 参数?

javascript - Nanoid 库无法作为事物板资源工作

python - jupyter notebook 如何导入不在当前工作目录中的模块?

python - 如何将经过身份验证的用户设置为序列化器?