1、安装alipay-sdk-python 时,保存内容如下。
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
╰─> [28 lines of output]
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
winrand.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(31): error C2061: 语法错误: 标识符“intmax_t”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(32): error C2061: 语法错误: 标识符“rem”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(32): error C2059: 语法错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(33): error C2059: 语法错误:“}”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(35): error C2061: 语法错误: 标识符“imaxdiv_t”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(35): error C2059: 语法错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(45): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(46): error C2146: 语法错误: 缺少“)”(在标识符“_Number”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(46): error C2061: 语法错误: 标识符“_Number”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(46): error C2059: 语法错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(47): error C2059: 语法错误:“)”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(50): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(51): error C2146: 语法错误: 缺少“)”(在标识符“_Numerator”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(51): error C2061: 语法错误: 标识符“_Numerator”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(51): error C2059: 语法错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(51): error C2059: 语法错误:“,”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(53): error C2059: 语法错误:“)”
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(55): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(61): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(68): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(74): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(81): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(87): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(94): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\inttypes.h(100): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.38.33130\\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
ERROR: Could not build wheels for pycrypto, which is required to install pyproject.toml-based projects
解决办法如下:
找到本机安装的Microsoft Visual Studio一般在C盘,如果安装到其他盘,请自行寻找。
我的路径如下:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include
找到stdint.h文件。复制到报错的路径下:
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\
然后修改报错的文件:
inttypes.h
把 inclue <stdint.h> 替换为 include "stdint.h"
再次安装 pip install pycrypto
或者安装alipay-sdk-python
即可