Tensorflow - ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed

混江龙づ霸主 提交于 2021-01-27 20:57:29

问题


I am struggling to utilise TensorFlow within Jupyter notebook. I have installed TensorFlow via Anaconda Prompt (running as admin). But when I go to call it in my notebook I get the following error string (sorry this is long).

Any help or thoughts would be welcomed here - should I run a full uninstall and try again?

kind regards Jack

I am running:

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense

The error message is as follows (there are a number of others but this is the first and the rest have similar issue):

Traceback (most recent call last): File "C:\Users\jjcon\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\jjcon\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\jjcon\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\Users\jjcon\Anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\Users\jjcon\Anaconda3\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:


回答1:


You have to install the Microsoft Visual C++ 2015-2019 Redistributable (x64) from here.

If you are facing any other issues possible reasons are

  • Your CPU does not support AVX2 instructions
  • Your CPU/Python is on 32 bits
  • There is a library that is in a different location/not installed on your system that cannot be loaded.

Please refer tested build configurations for windows CPU and GPU.



来源:https://stackoverflow.com/questions/60474219/tensorflow-importerror-dll-load-failed-a-dynamic-link-library-dll-initiali

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!