python - 在导入tensorflow的过程中,每次都会出现这个错误。我确实尝试卸载然后再次安装。它仍然给出同样的错误
问题描述
这是在 jupyter notebook 上将 tensorflow 作为 tf 代码导入后的错误
ImportError Traceback (most recent call last) ~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in 63 try: ---> 64 from tensorflow.python._pywrap_tensorflow_internal import * 65 # 这个try catch逻辑是因为py_extension 没有等效的 bazel。
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-1-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\Ayush\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.
解决方案
您缺少 dll 文件,您必须安装 Microsoft Visual C++ 2015 Redistributable 并确保根据此将 DLL 安装在 system32 文件夹中
我希望这有助于解决这个问题!
推荐阅读
- http - Grails HTTPResponse 失败的依赖异常
- javascript - 如何将来自 console.log 的打印消息直接添加到 javascript 的返回函数字符串中?
- symfony - 如何在easyadmin中为删除操作添加item_permission?
- javascript - 一些变量被多次加载
- javascript - 将数组元素的值与前一个元素相加
- php - php可以调用静态别名吗?
- php - 如何在没有 fosUser 的情况下在 fosCommentBundle 中添加输入用户名?
- javascript - 控制台显示 getElementsBy 的不同输出 ... 导致 Array.prototype.slice.call 在浏览器刷新时失败
- javascript - Node.js 要求找不到 libdpfpdd.so.2 文件,该文件与我的 .node 文件位于同一目录中
- python - 如何在我的 django 博客侧边栏上显示类别列表?