微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ImportError:DLL加载失败:动态链接库DLL初始化例程失败导入Tensorflow时

如何解决ImportError:DLL加载失败:动态链接库DLL初始化例程失败导入Tensorflow时

enter image description here

(devenv) C:\Users\parth.shah01\Desktop\devenv\Scripts>python
Python 3.7.0 | packaged by conda-forge | (default,Nov 12 2018,20:47:31) [MSC v.1900 64 bit (AMD64)] :: Anaconda,Inc. on win32
Type "help","copyright","credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "C:\Users\parth.shah01\Desktop\devenv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",line 64,in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load Failed: A dynamic link library (DLL) initialization routine Failed.
During handling of the above exception,another exception occurred:
Traceback (most recent call last):
  File "<stdin>",line 1,in <module>
  File "C:\Users\parth.shah01\Desktop\devenv\lib\site-packages\tensorflow\__init__.py",line 41,in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\parth.shah01\Desktop\devenv\lib\site-packages\tensorflow\python\__init__.py",line 40,in <module>
    from tensorflow.python.eager import context
  File "C:\Users\parth.shah01\Desktop\devenv\lib\site-packages\tensorflow\python\eager\context.py",line 35,in <module>
    from tensorflow.python import pywrap_tfe
  File "C:\Users\parth.shah01\Desktop\devenv\lib\site-packages\tensorflow\python\pywrap_tfe.py",line 28,in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\parth.shah01\Desktop\devenv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",line 83,in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\parth.shah01\Desktop\devenv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load Failed: A dynamic link library (DLL) initialization routine 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.

导入TensorFlow时出现此错误。安装成功。

cpu :英特尔(R)至强(R)cpu E5-2670 v3 @ 2.30GHz

操作系统:Windows Server 2016

python :3.7.6

TensorwFlow :2.3.0和2.2.0都给出相同的错误

已检查的参数

  • 为Visual Studio 2015、2017和2019安装了Microsoft Visual C ++ Redistributable

  • msvcp140_1.dll存在

  • 启用了AVX

TensorFlow 2.0.0已在此系统上运行。

该服务器无法访问互联网,因此要升级Tensorflow,我尝试了两种方法

  • 在本地计算机上创建conda环境包并复制并运行环境。

  • 在本地计算机上使用pip下载.whl文件并将其安装在远程服务器上

通过这两种方式,我都能够成功安装TensorFlow,但是在导入它时会出现此错误

请建议如何将TensorFlow 2.0.0升级到2.3.0。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。