windows - 为什么每次尝试导入 tensorflow 时都会出现错误消息?
问题描述
我使用 Windows 10 并成功安装了 tensorflow(包括 tensorflow-gpu)。但是当我尝试import tensorflow as tf
我得到以下错误:
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-4-64156d691fe5> in <module>
----> 1 import tensorflow as tf
~\Anaconda3\lib\site-packages\tensorflow\__init__.py in <module>
39 import sys as _sys
40
---> 41 from tensorflow.python.tools import module_util as _module_util
42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
43
~\Anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>
38 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
39
---> 40 from tensorflow.python.eager import context
41
42 # pylint: enable=wildcard-import
~\Anaconda3\lib\site-packages\tensorflow\python\eager\context.py in <module>
33 from tensorflow.core.protobuf import config_pb2
34 from tensorflow.core.protobuf import rewriter_config_pb2
---> 35 from tensorflow.python import pywrap_tfe
36 from tensorflow.python import tf2
37 from tensorflow.python.client import pywrap_tf_session
~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tfe.py in <module>
26
27 # pylint: disable=invalid-import-order,g-bad-import-order, wildcard-import, unused-import
---> 28 from tensorflow.python import pywrap_tensorflow
29 from tensorflow.python._pywrap_tfe import *
~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
81 for some common reasons and solutions. Include the entire stack trace
82 above this error message when asking for help.""" % traceback.format_exc()
---> 83 raise ImportError(msg)
84
85 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long
ImportError: Traceback (most recent call last):
File "C:\Users\manzs\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
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.
我阅读了 tensorflow 网站上的建议,但都没有帮助。
这是我 PC 上的 Windows 中的映射问题还是我需要上传 DLL?
解决方案
The DLL issue comes because of improperly configured CUDA and CuDNN. Please check if you have set the environment variables correctly. Also, it can come if your TF version is not compatible with CUDA version you have.
推荐阅读
- visual-studio - Visual Studio 2017 调试错误:为了防止在评估函数 *.toString 时发生不安全的中止,所有线程都被允许运行
- imagemagick - ImageMagick - 沿内部不透明对象边界分割透明图像
- r - 数据组的R多个滚动平均窗口
- python - 如何部署python脚本?
- python - 使用 Python API 在 IBM Cplex 中以代数模式输入二次规划问题
- python - 如何修改下面的 Python 代码以将字符附加到 Pandas 中字符串的开头?
- mysql - Pentaho Data Integration 8.1 存储库 mysql 错误 (conn:50787)
- spring-boot - Jboss 6.4 的 Spring Boot 2.0.0 War 部署问题
- jquery - Django 导入-导出 KeyError: u'id'
- javascript - d3.js:对嵌套数组进行排序