安装pythoncrypto 出现的一连串错误
**1.错误信息如下:
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building ‘Crypto.Random.OSRNG.winrandom’ extension
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/
----------------------------------------**
ERROR: Failed building wheel for pycrypto
ERROR: Command errored out with exit status 1:
解决办法:
提示要安装VC++14.0版本,拷贝错误提示的那串连接https://visualstudio.microsoft.com/visual-cpp-build-tools/,如果网络好应该是能很快下下来,网络不好的话可以尝试找一个这样的文件:vs_buildtools__1286720716.1626834762.exe,这个文件可以自动帮你安装,注意配置路径,提示需要很大空间。装好之后要重启。安装的内容:
Visual Studio 2019 version 16.10.4
2. 重启之后继续安装pycrypto,还是会报错:
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(81): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(87): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(94): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(100): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
error: command 'D:\\software\\vc++\\install\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
解决办法:
把安装目录下的D:\software\vc++\install\VC\Tools\MSVC\14.29.30037\include\stdint.h 拷贝到 C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\stdint.h
编辑 C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h 将#include <stdint.h> 改为#include “stdint.h”
-----以上解决办法均来源于网络+自己的实操,文章如有涉及侵权,请作者及时告知