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

时间:2020-11-05 05:44:08

标签: python tensorflow tensorflow2.x

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", line 64, 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。

0 个答案:

没有答案