python - Win10 : ImportError: DLL load failed: The specified module could not be found

标签 python tensorflow

每当我尝试在Anaconda提示符上导入tensorflow时,它都会给我这个错误:

Traceback (most recent call last):
  File "C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Dell\Anaconda3\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:\Users\Dell\Anaconda3\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\Dell\Anaconda3\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Dell\Anaconda3\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:\Users\Dell\Anaconda3\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\Dell\Anaconda3\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

我尝试安装 Visual C++ 2015 版本并使用“conda installtensorflow”重新安装tensorflow,它不断给出消息:

(base) C:\Users\Dell>conda install tensorflow
Collecting package metadata (repodata.json): done
Solving environment: done

所有请求的软件包已安装。

我应该做什么?

Python代码

import tensorflow as tf

最佳答案

大多数情况下,当您忘记首先激活 anaconda 提示符时,就会出现这些错误。因此:conda activateenvironment_name,然后是conda install tensorflow,然后通过在 anaconda 提示符中键入 python.exe 来启动 python.exe,并输入将tensorflow导入为tf

关于python - Win10 : ImportError: DLL load failed: The specified module could not be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57133906/

相关文章:

python - 如何在 NLTK 中将荷兰语文本与西类牙语部分分开?

python - FizzBu​​zz 神经网络

python - Django - 清理表单数据时出现 AttributeError 'User' 对象没有属性 'cleaned_data'

Python 套接字消息交换

python - Django模型减少重复代码

python-2.7 - 如何在 TensorFlow 中混合基于队列和基于提要的输入

python - 无法在 Colab 中运行具有 TF 2.0 和 GPU 支持的基本示例

python - 改变 plt.imshow() 图像像素的颜色

python - undefined symbol : clock_gettime with tensorflow on ubuntu14. 04

machine-learning - 语言翻译的序列到序列学习,未见过的单词呢