我目前正在尝试 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
我安装了 msvcp140_1.dll
并将其放入我的路径环境变量中包含的 C:\Users\User\AppData\Local\Programs\Python\Python37
。
如您所见,我使用的是 Python 3.7,因为 tensorflow 不支持 3.8。任何想法如何解决这一问题?
原文由 Mark Jacobsen 发布,翻译遵循 CC BY-SA 4.0 许可协议
您可以在 %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 拱门选择正确的软件包。