TF 2.0出现ImportError: DLL load failed: 找不到指定的模块-解决方案(hanlp用的是2.0tensorflow)

一、错误

C:\Users\HJ>py
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [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 "D:\ROOT\AppliedWare\python\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "D:\ROOT\AppliedWare\python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\ROOT\AppliedWare\python\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 "D:\ROOT\AppliedWare\python\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "D:\ROOT\AppliedWare\python\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\ROOT\AppliedWare\python\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "D:\ROOT\AppliedWare\python\lib\site-packages\tensorflow\python\__init__.py", line 50, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "D:\ROOT\AppliedWare\python\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "D:\ROOT\AppliedWare\python\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "D:\ROOT\AppliedWare\python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\ROOT\AppliedWare\python\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 "D:\ROOT\AppliedWare\python\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "D:\ROOT\AppliedWare\python\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。


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.

二、查询依赖

参考我的另外一篇https://blog.csdn.net/LearnToPain/article/details/100924668

:\Users\HJ>"c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\dumpbin.exe" /dependents D:\ROOT\AppliedWare\python\lib\site-packages\tensorflow\python\_pywrap_tensorflow_internal.pyd
Microsoft (R) COFF/PE Dumper Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file D:\ROOT\AppliedWare\python\lib\site-packages\tensorflow\python\_pywrap_tensorflow_internal.pyd

File Type: DLL

  Image has the following dependencies:

    python36.dll
    ADVAPI32.dll
    WS2_32.dll
    MSVCP140.dll
    SHLWAPI.dll
    dbghelp.dll
    SHELL32.dll
    ole32.dll
    KERNEL32.dll
    VCRUNTIME140.dll
    VCRUNTIME140_1.dll
    api-ms-win-crt-stdio-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-utility-l1-1-0.dll
    api-ms-win-crt-math-l1-1-0.dll
    api-ms-win-crt-environment-l1-1-0.dll
    api-ms-win-crt-locale-l1-1-0.dll
    api-ms-win-crt-filesystem-l1-1-0.dll
    api-ms-win-crt-convert-l1-1-0.dll
    api-ms-win-crt-time-l1-1-0.dll

三、查找缺失的dll

两个路径(如果你的系统是64位)一个是:C:\WINDOWS\SysWOW64,另外一个python安装路径:D:\ROOT\AppliedWare\python

本主查询结果是缺失vcruntime140_1.dll

下载一个放进去即可

 

四、效果

C:\Users\HJ>py
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2020-05-16 20:52:18.995266: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-05-16 20:52:19.000829: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
>>> tf.__version__
'2.2.0'
>>>

 cudart64_101.dll not found
只用cpu可以不管,不过下载一个放在cuda的bin目录就可以了,或者之前的改个名字

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
出现"ImportError: DLL load failed: 不到指定模块"错误时,这通常是由于缺少依赖库或者tensorflow版本不匹配所导致的。 一种可能的解决方法是确保您安装的tensorflow版本与您的系统兼容。您可以尝试降低tensorflow的版本,例如使用命令`pip install tensorflow==1.5.0`来安装tensorflow版本为1.5.0。 另外,您还可以检查您的系统是否缺少必要的依赖库。在Windows系统上,可以尝试安装Microsoft Visual C++ Redistributable for Visual Studio 2015,并确保您的系统已经安装了CUDA和cuDNN(如果您的tensorflow版本需要)。 此外,还可以尝试使用anaconda来安装tensorflow,因为anaconda可以自动解决依赖库的安装问题。您可以使用命令`conda install tensorflow`来安装tensorflow。 如果您仍然遇到问题,建议您查具体的错误信息以及您使用的操作系统和tensorflow版本,然后在相关的论坛或社区提问,以便其他人能够更好地帮助您解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Tensorflow安装后,import时出现错误:ImportError: DLL load failed: 不到指定模块](https://blog.csdn.net/weixin_39750084/article/details/85722233)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [导入tensorflow包报错——ImportError: DLL load failed: 不到指定模块](https://blog.csdn.net/weixin_47585015/article/details/110358232)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [ImportError: DLL load failed: 不到指定模块。](https://download.csdn.net/download/weixin_38637884/13742003)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值