windows安装pycrypto出错解决

1.执行命令报错

pip install pycrypto

Installing collected packages: pycrypto
Running setup.py install for pycrypto ... error
ERROR: Command errored out with exit status 1

2.下载安装 visual studio

https://visualstudio.microsoft.com/zh-hans/

 

3.错误原因

C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(53): error C2059: 语法错误:“)”
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(55): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)

inttypes.h 出错

4.解决方法

1.找到 Visual Studio 2022 的安装位置,右键,打开文件所在位置

2.去到目录:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include

3.找到 stdint.h

4.将 stdint.h 复制到 Windows Kits报错的路径:C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h(100): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面) 的 C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt 目录下

5.修改 C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\inttypes.h

将第14行的尖括号改为双引号 #include <stdint.h> --> #include "stdint.h"

5.问题解决,可以正常安装 pycrypto

posted @ 2022-11-17 10:20  chenjianwen  阅读(1272)  评论(0编辑  收藏  举报