import tensroflow时出现了ImportError: DLL load failed: 找不到指定的模块的解决办法

2022-07-27,,,,

import tensroflow时出现了ImportError: DLL load failed: 找不到指定模块解决办法

  在anaconda环境中,使用pip install tensorflow安装了tensorflow后,无论是在正确环境下使用PyChram还是python shell都无法正确加载,出现了如下的问题:

(tf) C:\Users\bwq>python
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\AnaConda3\envs\tf\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "D:\AnaConda3\envs\tf\lib\site-packages\tensorflow\python\__init__.py", line 40, in <module>
    from tensorflow.python.eager import context
  File "D:\AnaConda3\envs\tf\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>
    from tensorflow.python import pywrap_tfe
  File "D:\AnaConda3\envs\tf\lib\site-packages\tensorflow\python\pywrap_tfe.py", line 29, in <module>
    from tensorflow.python._pywrap_tfe import *
ImportError: DLL load failed: 找不到指定的模块。

即为:ImportError: DLL load failed: 找不到指定的模块。

  在网上查找了一些资料进行调整后,并没有成功,于是乎想到了可能是tensorflowPython版本不匹配的问题。我这里的python版本是3.5.2的。在该网址上https://blog.csdn.net/qq_41621362/article/details/89196753可以查看tensorflowpython的匹配版本。

  使用如下命令即可:

  1. pip uninstall tensorflow

  2. 删除原来版本的tensorflow之后,安装与python3.5.2所对应的tensorflow版本,使用命令:pip install tensorflow==1.12.0

  3. 安装成功以后,使用python shell再次尝试,已经成功解决问题。

本文地址:https://blog.csdn.net/bwqiang/article/details/110285801

《import tensroflow时出现了ImportError: DLL load failed: 找不到指定的模块的解决办法.doc》

下载本文的Word格式文档,以方便收藏与打印。