pip安装tensorflow成功但无法import

Traceback (most recent call last):
File “C:\mysoft\Python\Python35\lib\site-packages\tensorflow\python\platform\self_check.py”, line 47, in preload_check
ctypes.WinDLL(build_info.msvcp_dll_name)
File “C:\mysoft\Python\Python35\lib\ctypes_init_.py”, line 347, in init
self._handle = dlopen(self.name, mode)
OSError: [WinError 126] 找不到指定的模块。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “”, line 1, in
import tensorflow
File "C:\mysoft\Python\Python35\lib\site-packages\tensorflow_init
.py", line 24, in
from tensorflow.python import *
File "C:\mysoft\Python\Python35\lib\site-packages\tensorflow\python_init
.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File “C:\mysoft\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 30, in
self_check.preload_check()
File “C:\mysoft\Python\Python35\lib\site-packages\tensorflow\python\platform\self_check.py”, line 55, in preload_check
% build_info.msvcp_dll_name)
ImportError: Could not find ‘msvcp140.dll’. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. You may install this DLL by downloading Visual C++ 2015 Redistributable Update 3 from this URL: https://www.microsoft.com/en-us/download/details.aspx?id=53587

上述情况是由于没有安装微软vs2015提供的组件Visual C++ Redistributable for Visual Studio 2015,官网地址为https://www.microsoft.com/zh-CN/download/details.aspx?id=48145,可以从这里下载http://down.tech.sina.com.cn/page/65577.html。

安装之后可以正常导入。
————————————————
版权声明:本文为CSDN博主「小小北漂」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u014589856/article/details/78925840

你可能感兴趣的:(pip安装tensorflow成功但无法import)