安装tf遇到以下问题解决办法之一:
Traceback (most recent call last):
File “I:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File “I:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File “I:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 24, in swig_import_helper
_mod = imp.load_module(‘_pywrap_tensorflow_internal’, fp, pathname, description)
File “I:\Anaconda3\lib\imp.py”, line 242, in load_module
return load_dynamic(name, filename, file)
File “I:\Anaconda3\lib\imp.py”, line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “”, line 1, in
File “I:\Anaconda3\lib\site-packages\tensorflow_init_.py”, line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File “I:\Anaconda3\lib\site-packages\tensorflow\python_init_.py”, line 49, in
from tensorflow.python import pywrap_tensorflow
File “I:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File “I:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File “I:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File “I:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 24, in swig_import_helper
_mod = imp.load_module(‘_pywrap_tensorflow_internal’, fp, pathname, description)
File “I:\Anaconda3\lib\imp.py”, line 242, in load_module
return load_dynamic(name, filename, file)
File “I:\Anaconda3\lib\imp.py”, line 342, in load_dynamic
return _load(spec)
## 主要错误定位### #
ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。
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.
上面的代码是复制文章https://blog.csdn.net/qq_27276951/article/details/85942108中的
这个是linux系统的。我安装的是window的。出现问题后解决了,问题说明找不到了,所以引用一下。
开始我可以直接安装python3.8+tensorflow2.3,没有问题
但是重新安装个系统后再安装就出现上述问题。
刚开始以为是因为先安装的pycharm的问题,然后卸载,再安装,没有解决。安装anaconda再安装,没有解决。anaconda还打不开了。解决办法是有个帖子用了五步代码解决。然后以为是python版本太高。安装了3.8,3.7版本的分别安装了tensorflow2.3,2.2,2.1,2.0.
终于在安装了3.7+2.0版本的全部解决。
我的本是i56300HQ+英伟达的960.估计确实是因为cpu太老了,但是我开始安装过3.8+tf2.3的,可以运行。不知什么原因。
猜测原因:
1,cup,系统(重装的系统是win10 2004版本的),tf三者不兼容
2,可能是vs的问题(没装系统前装的东西特别多,所以我也不确定)
如果想稳定一点的建议安装3.7+tf2.0,可以运行GRU网络。
博客内有相应 tf2.0,要是直接下的话会很慢,也可以去清华源看看下载快不快,我有时快有时慢。
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/tensorflow/
记得看好版本,37表示python3.7,以此类推。还有系统,mac,Linux,windows
看好,切记
(第一次写博客,请大家多多支持)