python - Pip 错误 : Microsoft Visual C++ 14. 需要 0

标签 python python-3.x python-3.6 pycrypto

我刚刚运行了以下命令:

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\

最佳答案

安装pycrypto需要安装Microsoft Visual C++ 14.0:

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_Studio_2019_.28x86.2C_x64.2C_ARM.2C_ARM64.29

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

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

安装完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 选项的命令。

关于python - Pip 错误 : Microsoft Visual C++ 14. 需要 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44951456/

相关文章:

python - Django 在速记渲染方法中添加自定义 header

python - 循环内部 lambda

python - 为什么我的代码在 windows 上运行良好,但在 ubuntu 上却不行

Windows Server 2012 R2 x64 上带有 Python 3.6.4 的 OpenCV 导入 cv2 : DLL not found

python - 将文本输入保存到 kivy 应用程序中的变量

Python CLI 程序单元测试

python - make 在 make 调用期间找不到 OpenCV 库

python - ScrollLabel 产生 ValueError

python - 如何在 MSYS2 上安装 Python 开发工具

python - 根据 'parent' 元组值对字典进行排序