(windows)pip install pycrypto:error: Microsoft Visual C++ 14.0 is required. Get it with “Build Tools

在Windows上进行AES加密时遇到pycrypto安装问题,需要Microsoft Visual C++ 14.0。然而,直接下载Build Tools for Visual Studio可能缓慢且复杂。文章作者发现,对于Windows用户,可以使用pycryptodome代替pycrypto,它无需额外的VC++编译器,能顺利解决安装问题。这是一个更便捷的替代方案,适合快速在Windows上进行AES加密操作。
    .....
    copying lib\Crypto\Signature\__init__.py -> build\lib.win-amd64-3.7\Crypto\Signature
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma
    running build_ext
    warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
    building 'Crypto.Random.OSRNG.winrandom' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

使用AES加密,安装pycrypto时出现,需要Microsoft Visual C++ 14.0, 按照提示连接需要下载vs很大也很慢,网上找了很多资料都是需要安装,通过buildtool, 但是很瞎,我本地安装一直有问题,连不上微软的网站。

上面路子比较偏,因为不精所以无知,后来发现windows上的AES使用的是pip install pycryptodome, 安装这个适用于windows,pycrypto适用于linux或者mac。

参考:

pycryptodome

C:\Users\Administrator\PyCharmMiscProject\.venv\Scripts\python.exe C:/Program Files/JetBrains/PyCharm 2025.2.0.1/plugins/python-ce/helpers/packaging_tool.py install machine Collecting machine Using cached machine-0.0.1-py2.py3-none-any.whl.metadata (2.0 kB) Collecting pycrypto (from machine) Using cached pycrypto-2.6.1.tar.gz (446 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Using cached machine-0.0.1-py2.py3-none-any.whl (4.2 kB) Building wheels for collected packages: pycrypto Building wheel for pycrypto (pyproject.toml): started Building wheel for pycrypto (pyproject.toml): finished with status 'error' Failed to build pycrypto error: subprocess-exited-with-error Building wheel for pycrypto (pyproject.toml) did not run successfully. exit code: 1 [15 lines of output] C:\Users\Administrator\AppData\Local\Temp\pip-build-env-cap8bpjl\overlay\Lib\site-packages\setuptools\dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated. !! ******************************************************************************** Please consider removing the following classifiers in favor of a SPDX license expression: License :: Public Domain See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details. ******************************************************************************** !! self._finalize_license_expression() warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pycrypto [notice] A new release of pip is available: 25.1.1 -> 25.2 [notice] To update, run: python.exe -m pip install --upgrade pip ERROR: Failed to build installable wheels for some pyproject.toml based projects (pycrypto) 分析一下上面的异常
最新发布
08-16
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值