安装 tensorflow cpu 版出问题, 求解决办法。 谢谢

安装 tensorflow cpu 版出问题, 求解决办法。 谢谢

Windows 10 64bits, anaconda-3.4.2(Python3.5.2), tensorflow version 1.11-0, 第一次运行时报错:
ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。

Environment parameter
path:
C:\Program Files\Microsoft MPI\Bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\CUDA\bin64;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\lib\x64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\extras\CUPTI\libx64;C:\Program Files\Microsoft VS Code;C:\Program Files\Anaconda3;C:\Program Files\Anaconda3\Scripts;C:\Program Files\Anaconda3\Library\bin;

MSVCP140.DLL在以下2个目录
C:\Program Files\Anaconda3
C:\Program Files\Anaconda3\Library\bin

C:\Windows\system32>python
Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

C:\Windows\system32>pip install tensorflow
Collecting tensorflow
Using cached https://files.pythonhosted.org/packages/af/5b/695e2e66feb27742a78f938d8369cc874b5fc7082193c3352c9db599af01/tensorflow-1.11.0-cp35-cp35m-win_amd64.whl
Requirement already satisfied: grpcio>=1.8.6 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.16.0)
Requirement already satisfied: astor>=0.6.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (0.7.1)
Requirement already satisfied: numpy>=1.13.3 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.15.3)
Requirement already satisfied: keras-applications>=1.0.5 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.0.6)
Requirement already satisfied: absl-py>=0.1.6 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (0.6.1)
Requirement already satisfied: six>=1.10.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.10.0)
Requirement already satisfied: setuptools<=39.1.0 in c:\program files\anaconda3\lib\site-packages\setuptools-27.2.0-py3.5.egg (from tensorflow) (27.2.0)
Requirement already satisfied: protobuf>=3.6.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (3.6.1)
Requirement already satisfied: keras-preprocessing>=1.0.3 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.0.5)
Requirement already satisfied: termcolor>=1.1.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.1.0)
Requirement already satisfied: gast>=0.2.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (0.2.0)
Requirement already satisfied: wheel>=0.26 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (0.29.0)
Requirement already satisfied: tensorboard=1.11.0 in c:\program files\anaconda3\lib\site-packages (from tensorflow) (1.11.0)
Requirement already satisfied: h5py in c:\program files\anaconda3\lib\site-packages (from keras-applications>=1.0.5->tensorflow) (2.6.0)
Requirement already satisfied: markdown>=2.6.8 in c:\program files\anaconda3\lib\site-packages (from tensorboard=1.11.0->tensorflow) (3.0.1)
Requirement already satisfied: werkzeug>=0.11.10 in c:\program files\anaconda3\lib\site-packages (from tensorboard=1.11.0->tensorflow) (0.11.11)
Installing collected packages: tensorflow
Successfully installed tensorflow-1.11.0

错误信息:

ImportError Traceback (most recent call last)
C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in ()
57
---> 58 from tensorflow.python.pywrap_tensorflow_internal import *
59 from tensorflow.python.pywrap_tensorflow_internal import version

C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in ()
27 return _mod
---> 28 _pywrap_tensorflow_internal = swig_import_helper()
29 del swig_import_helper

C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper()
23 try:
---> 24 _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
25 finally:

C:\Program Files\Anaconda3\lib\imp.py in load_module(name, file, filename, details)
241 else:
--> 242 return load_dynamic(name, filename, file)
243 elif type_ == PKG_DIRECTORY:

C:\Program Files\Anaconda3\lib\imp.py in load_dynamic(name, path, file)
341 name=name, loader=loader, origin=path)
--> 342 return _load(spec)
343

ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
in ()
----> 1 import tensorflow as tf

C:\Program Files\Anaconda3\lib\site-packages\tensorflow__init__.py in ()
20
21 # pylint: disable=g-bad-import-order
---> 22 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
23
24 try:

C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python__init__.py in ()
47 import numpy as np
48
---> 49 from tensorflow.python import pywrap_tensorflow
50
51 # Protocol buffers

C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in ()
72 for some common reasons and solutions. Include the entire stack trace
73 above this error message when asking for help.""" % traceback.format_exc()
---> 74 raise ImportError(msg)
75
76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\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 "C:\Program Files\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Program Files\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/install_sources#common_installation_problems

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

4个回答

建议向较低版本Tensorflow逐一尝试,版本过高可能导致对CPU不支持。

lsbt022
lsbt022 谢谢,最后是版本1.5.0顺利通过。
接近 2 年之前 回复

你好,感觉是你安装的Tensorflow版本过高导致的,建议卸载下载的版本安装tensorflow-1.8.0试试。

lsbt022
lsbt022 谢谢。 谢谢,最后是版本1.5.0顺利通过。电脑的CPU是6700,是古董。
接近 2 年之前 回复

不需要降低版本,我用的cpu是Intel Xeon L5640,显然不支持avx,更不要说avx2 fma3 avx512了,照样用的美滋滋。
要知道双路x58有多便宜了。
具体你看这里:
https://github.com/fo40225/tensorflow-windows-wheel

下面有个列表,你注意看
1.8.0\py36\CPU\sse2 VS2017 15.4 No x86_64 Python 3.6
这里就是说,不需要gpu,不需要avx2,python 3.6语言,你然后再下载对应的whl
下载后安装下,ok

重启电脑试试= =
硬件环境: i5-8400+gtx1060
软件环境: Win10+CUDA10.0+Tensorflow-gpu1.13+python3.7.2
不用装Visual studio, Anaconda等
折腾了一晚上,最后重启解决= =
目测是刚装上CUDA,环境变量需要重启才更新。。。
醉了醉了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐