Tensorflow - ImportError: Could not find 'msvcp140.dll'

社会主义新天地 提交于 2020-11-29 03:16:26

问题


I am just a beginner to a tensorflow and trying to install TensorFlow with CPU support only.

Initially, I downloaded and installed Python 3.5.2 version from https://www.python.org/downloads/release/python-352/

After successful installation, I ran the command pip3 install --upgrade tensorflow which installed tensorflow-1.8.0.

To test installation i just ran following commands:

> python

> import tensorflow as tf

But this gave me an error:

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

I searched for this issue and found link to an issue https://github.com/tensorflow/tensorflow/issues/17393.

According to above i tried running command

pip install tensorflow==1.5

But, this didn't solved my problem.

I even tried downloading msvcp140.dll and manually coping it under C:\Windows\SysWOW64 folder and reinstalling python and tensorflow.

How do I fix this problem.

Thanks in advance.


回答1:


I copied msvcp140.dll to path C:\Users\PCName\AppData\Local\Programs\Python\Python35 and it worked for me.

I also switched back to tensorflow 1.8 from 1.5.




回答2:


download msvcp140.dll or click https://www.dll-files.com/msvcp140.dll.html

find your python path
path will find easy from your error

error will show like this

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\sky network\AppData\Local\Programs\Python\Python36\lib\site- 
packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\sky network\AppData\Local\Programs\Python\Python36\lib\site- 
packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\sky network\AppData\Local\Programs\Python\Python36\lib\site- 
packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
self_check.preload_check()
File "C:\Users\sky network\AppData\Local\Programs\Python\Python36\lib\site- 
packages\tensorflow\python\platform\self_check.py", line 55, in preload_check
% build_info.msvcp_dll_name)

from my error the python path is

"File "C:\Users\sky network\AppData\Local\Programs\Python\Python36"

if u cant find the AppData folder

click folder view option and enable hidden files

paste the file "msvcp140.dll" into

C:\Users\sky network\AppData\Local\Programs\Python\Python36




回答3:


You can download the package from the url https://www.microsoft.com/en-us/download/details.aspx?id=53587 and install it. This will solve the issue.



来源:https://stackoverflow.com/questions/50777013/tensorflow-importerror-could-not-find-msvcp140-dll

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