无法 pip install Tensorflow 'msvcp140_1.dll' 丢失

Mar*_*sen 9 python tensorflow

我目前正在尝试pip install tensorflow,它可以工作,但是在我安装它之后,然后通过import tensorflow as tf我收到以下错误消息将其导入我的 python 模块:

ImportError: Could not find the DLL(s) 'msvcp140_1.dll'. TensorFlow requires that
these DLLs be installed in a directory that is named in your %PATH% environment
variable. You may install these DLLs by downloading "Microsoft C++ Redistributable
for Visual Studio 2015, 2017 and 2019" for your platform from this URL: 
https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads
Run Code Online (Sandbox Code Playgroud)

我安装了msvcp140_1.dll并将它放入C:\Users\User\AppData\Local\Programs\Python\Python37包含在我的路径环境变量中。

如您所见,我使用的是 Python 3.7,因为 tensorflow 不支持 3.8。任何想法如何解决这一问题?

小智 7

您可以在 %windows%/System32 文件夹中找到 msvcp140.dll,一旦您为 VS 2015 安装了 VC++ DIST,对于 msvcp140_1.dll,您需要转到此页面

https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

在 :Visual Studio 2015、2017 和 2019 部分中,根据您的 PC 架构选择正确的软件包。


小智 5

只需单击此链接https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads然后安装

x64: vc_redist.x64.exe

并重新启动您的电脑。