[英]Error when importing tensorflow in Pyhton 3.8
I am using我在用
and when I import tensorflow as tf
on the Python IDLE, it shows the below error:当我在 Python IDLE import tensorflow as tf
时,它显示以下错误:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 動態連結程式庫 (DLL) 初始化例行程序失敗。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python\Python__MyFinalProject__ML\TensorFlow.py", line 3, in <module>
import tensorflow
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\__init__.py", line 39, in <module>
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 動態連結程式庫 (DLL) 初始化例行程序失敗。
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
want to ask for the reason why it causes this error and solutions to solve this: )想问一下导致这个错误的原因和解决方法:)
And I'm sorry that there are some traditional chinese characters and I google translate it: "動態連結程式庫 (DLL) 初始化例行程序失敗。" --> "The dynamic link library (DLL) initialization routine failed."还有很抱歉有一些繁体字,我google一下:“动态链接程序库(DLL)初始化例行程序失败。” -->“动态链接库(DLL)初始化例程失败。”
The workaround is to simply install Microsoft Visual C++ 2015 Redistributable 64 bits .解决方法是简单地安装Microsoft Visual C++ 2015 Redistributable 64 bits 。 This way, the DLL is installed in system32 folder and the bug can be rectified.这样DLL就安装在system32文件夹下, bug就可以解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.