Home > other >  Import tf2 times wrong: ImportError: DLL load failed: the dynamic link library (DLL) initialization
Import tf2 times wrong: ImportError: DLL load failed: the dynamic link library (DLL) initialization

Time:11-11

Environment:
Win10
Anaconda 2020.07.20
Virtual environment tf2nlp + python3.7

Problem: enter a virtual environment, installation: PIP install tensorflow==2.0, start the python, import tensorflow, appeared the following error, then I according to the error prompt, go to the Microsoft website to download VC_redist. X64. Exe for installation, an error is still the same, however, the related articles on the net are said to reduce the tf version, but the drop is not my idea, I want to use the tensorflow2. X, because tf1. X is outdated and no longer have to maintain, so I want to know what method can solve this error?

An error is as follows:
 
ImportError: DLL load failed: the dynamic link library (DLL) initialization routine failed,

During handling of the above exception, another exception occurred:

Traceback (the most recent call last) :
File "" , the line 1, the in & lt; module>
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ site - packages \ tensorflow \ set py", line 98, in & lt; module>
The from tensorflow_core import *
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ site - packages \ tensorflow_core \ set py", line 42, in & lt; module>
From the _api. V2 import audio
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ site - packages \ audio \ \ tensorflow_core \ _api \ v2 set py", line 10, the in & lt; module>
The from tensorflow. Python. Ops. Gen_audio_ops import decode_wav
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ site - packages \ tensorflow_core \ python \ ops \ gen_audio_ops py", line 9, the in & lt; module>
The from tensorflow. Python import pywrap_tensorflow as _pywrap_tensorflow
File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ site - packages \ tensorflow \ set py", line, 50 in __getattr__
The module=self. _load ()
File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ site - packages \ tensorflow \ set py", line 44, in _load
The module=_importlib. Import_module (self. __name__)
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ importlib \ set py", line 127, in import_module
Return _bootstrap. _gcd_import (name [level:], package, level)
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ site - packages \ tensorflow_core \ python \ set py", line 49, in & lt; module>
The from tensorflow. Python import pywrap_tensorflow
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ site - packages \ tensorflow_core \ python \ pywrap_tensorflow py", line 74, in & lt; module>
Raise ImportError (MSG)
ImportError: Traceback (the most recent call last) :
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ site - packages \ tensorflow_core \ python \ pywrap_tensorflow py", 58, line in & lt; module>
The from tensorflow. Python. Pywrap_tensorflow_internal import *
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ site - packages \ tensorflow_core \ python \ pywrap_tensorflow_internal py", 28, the line in & lt; module>
_pywrap_tensorflow_internal=swig_import_helper ()
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ site - packages \ tensorflow_core \ python \ pywrap_tensorflow_internal py", line 24, in swig_import_helper
_mod=imp. Load_module (' _pywrap_tensorflow_internal, fp, the pathname, description)
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ imp py", line 243, in the load_module
Return load_dynamic (name, filename, file)
The File "C: \ Anaconda3 \ envs \ tf2nlp \ lib \ imp py", line 343, in load_dynamic
Return _load (spec)
ImportError: DLL load failed: the dynamic link library (DLL) initialization routine failed,


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

For some common having and solutions. Include the - stack trace
Above this error message when have for help.

CodePudding user response:

Conda try
  • Related