Pip 错误:需要 Microsoft Visual C 14.0

新手上路,请多包涵

我刚刚运行了以下命令:

 pip install -U steem

并且安装运行良好,直到无法安装 pycrypto 。之后我做了

pip install cryptography

命令,因为我认为它是丢失的包。所以我的问题是,我如何安装 steem 没有 pycrypto-error(或另外的 pycrypto-package)以及如何卸载我不需要的 cryptography-Package。 (我使用的是 Windows 7 和 Python 3)

 Requirement already up-to-date: python-dateutil in c:\users\***\appdata\lo
cal\programs\python\python36\lib\site-packages (from dateparser->maya->steem)
...
Installing collected packages: urllib3, idna, chardet, certifi, requests, pycryp
to, funcy, w3lib, voluptuous, diff-match-patch, scrypt, prettytable, appdirs, la
ngdetect, ruamel.yaml, humanize, tzlocal, regex, dateparser, pytzdata, pendulum,
maya, ecdsa, pylibscrypt, ujson, toolz, steem
Running setup.py install for pycrypto ... error
Complete output from command c:\users\***\appdata\local\programs\pytho
n\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\
***~1\\AppData\\Local\\Temp\\pip-build-k6flhu5k\\pycrypto\\setup.py';f=getattr(
tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();
exec(compile(code, __file__, 'exec'))" install --record C:\Users\***N~1\AppDat
a\Local\Temp\pip-igpkll6u-record\install-record.txt --single-version-externally-
managed --compile:
running install
running build
running build_py
...
building 'Crypto.Random.OSRNG.winrandom' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

----------------------------------------
Command "c:\users\***\appdata\local\programs\python\python36\python.exe -u
-c "import setuptools, tokenize;__file__='C:\\Users\\***N~1\\AppData\\Local\\
Temp\\pip-build-k6flhu5k\\pycrypto\\setup.py';f=getattr(tokenize, 'open', open)(
__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code,   __fil
e__, 'exec'))" install --record C:\Users\***N~1\AppData\Local\Temp\pip-igpkll6
u-record\install-record.txt --single-version-externally-managed --compile"   faile
d with error code 1 in C:\Users\***N~1\AppData\Local\Temp\pip-build-    k6flhu5k\p
ycrypto\

原文由 Studentu 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 656
2 个回答

您需要安装 Microsoft Visual C++ 14.0 才能安装 pycrypto:

 error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

在评论中,您询问要使用哪个链接。使用指向 Visual C++ 2015 Build Tools 的链接。这将在不安装 Visual Studio 的情况下安装 Visual C++ 14.0。

备用链接: https ://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.2_standalone:_Build_Tools_for_Visual_Studio2019.28x86.2C_x64.2C_ARM.2C_ARM64.29

在评论中,您询问了不需要安装编译器的安装方法 pycrypto 。链接中的二进制文件似乎适用于比您使用的更早版本的 Python。一个链接指向 DropBox 帐户中的二进制文件。

我不建议下载第三方提供的加密库的二进制版本。保证您获得与您的 Python 版本兼容且未使用任何后门构建的 pycrypto 版本的唯一方法是从源代码构建它。

安装 Visual C++ 后,只需重新运行原始命令:

 pip install -U steem

要了解各种安装选项的含义,请运行以下命令:

 pip help install

-U 选项的帮助说

-U, --upgrade        Upgrade all specified packages to the newest available
                     version. The handling of dependencies depends on the
                     upgrade-strategy used.

如果您尚未安装 steem 库,则可以在没有 -U 选项的情况下运行该命令。

原文由 David Cullen 发布,翻译遵循 CC BY-SA 4.0 许可协议

如果您已经安装了 Visual Studio Build Tools 但仍然出现该错误,那么您可能需要“修改”您的安装以包含 Visual C++ 构建工具。

要做到这一点:

  1. 打开 Visual Studio 安装程序(如果需要,您可以在“开始”菜单中搜索它)。

  2. 找到Visual Studio Build Tools,点击“修改”:

在此处输入图像描述

  1. 勾选Visual C++构建工具,然后点击右下角的“修改”进行安装:

在此处输入图像描述

C++ 工具安装完成后,再次运行 pip 命令,它应该可以工作了。

原文由 Pikamander2 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题