错误信息如下:
Collecting pycrypto ? Using cached pycrypto-2.6.1.tar.gz (446 kB) ? Preparing metadata (setup.py) ... done Building wheels for collected packages: pycrypto ? Building wheel for pycrypto (setup.py) ... error ? error: subprocess-exited-with-error
? × python setup.py bdist_wheel did not run successfully. ? │ exit code: 1 ? ╰─> [183 lines of output] ? ? ? running bdist_wheel
..........
winrand.c ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(31): error C2061: 语法错误: 标识符“intmax_t” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(32): error C2061: 语法错误: 标识符“rem” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(32): error C2059: 语法错误:“;” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(33): error C2059: 语法错误:“}” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(35): error C2061: 语法错误: 标识符“imaxdiv_t” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(35): error C2059: 语法错误:“;” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(45): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面) ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(46): error C2146: 语法错误: 缺少“)”(在标识符“_Number” 的前面) ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(46): error C2061: 语法错误: 标识符“_Number” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(46): error C2059: 语法错误:“;” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(47): error C2059: 语法错误:“)” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(50): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面) ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2146: 语法错误: 缺少“)”(在标识符“_Numerator”的前面) ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2061: 语法错误: 标识符“_Numerator” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2059: 语法错误:“;” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(51): error C2059: 语法错误:“,” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(53): error C2059: 语法错误:“)” ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(55): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面) ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(61): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面) ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(68): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面) ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(74): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面) ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(81): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面) ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(87): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面) ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(94): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面) ? ? ? D:\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(100): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面) ? ? ? error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 ? ? ? [end of output]
? note: This error originates from a subprocess, and is likely not a problem with pip. ? ERROR: Failed building wheel for pycrypto ? Running setup.py clean for pycrypto Failed to build pycrypto Installing collected packages: pycrypto ? Running setup.py install for pycrypto ... error ? error: subprocess-exited-with-error
解决方法:
将Microsoft Visual Studio安装目录(D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include)下的stdint.h文件复制到
D:\Windows Kits\10\Include\10.0.19041.0\ucrt
并将D:\Windows Kits\10\Include\10.0.19041.0\ucrt目录下的inttypes.h下的尖括号改成双引号(引号是引用非标准库的头文件,编译器从用户的工作目录开始搜索)
?然后重新安装:pip install pycrypto
|