错误一: error: Microsoft Visual C++ 14.0 is required.
解决办法:
- 下载Visual C++2017安装包,下载链接:Visual C++ 2017 安装包下载
原文 https://blog.****.net/heyshheyou/article/details/82022948
错误二: 语法错误: 标识符“intmax_t”
解决办法
32位
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build 注 Community需要换成自己系统的值 比如我的是 Enterprise
vcvarsall.bat x86_amd64
set CL=-FI"%VCToolsInstallDir%\include\stdint.h
pip install pycrypto
64位
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build 注 Community需要换成自己系统的值 比如我的是 Enterprise
vcvarsall.bat x64
set CL=-FI"%VCToolsInstallDir%\include\stdint.h
pip install pycrypto
===============================================================================
附完整的错误提示:
1、python环境
>python -V
Python 3.7.0
2、pip install pycrypto报错如下
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
27): error C2061: 语法错误: 标识符“intmax_t”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
28): error C2061: 语法错误: 标识符“rem”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
28): error C2059: 语法错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
29): error C2059: 语法错误:“}”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
31): error C2061: 语法错误: 标识符“imaxdiv_t”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
31): error C2059: 语法错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
41): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
42): error C2146: 语法错误: 缺少“)”(在标识符“_Number”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
42): error C2061: 语法错误: 标识符“_Number”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
42): error C2059: 语法错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
43): error C2059: 语法错误:“)”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
46): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
47): error C2146: 语法错误: 缺少“)”(在标识符“_Numerator”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
47): error C2061: 语法错误: 标识符“_Numerator”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
47): error C2059: 语法错误:“;”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
47): error C2059: 语法错误:“,”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
49): error C2059: 语法错误:“)”
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
51): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
57): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
64): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
70): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
77): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
83): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
90): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\inttypes.h(
96): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Comm
unity\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe' failed with exit
status 2
—————————————-
Command "c:\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\
\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-bf6lznwz\\pycrypto\\setup.py
';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n'
);f.close();exec(compile(code, __file__, 'exec'))" install –record C:\Users\ADM
INI~1\AppData\Local\Temp\pip-record-xxn48yyz\install-record.txt –single-version
-externally-managed –compile" failed with error code 1 in C:\Users\ADMINI~1\App
Data\Local\Temp\pip-install-bf6lznwz\pycrypto\
==================================================================================
错误三、以上办法均使用,仍然不好使,去网上找对应版本的whl,手动安装 pip installer pycrypto-2.6.1-cp35-cp35m-win_amd64.whl
如我的是python35 64位电脑 对应的 资源地址为:pycrypto-2.6.1-cp35-cp35m-win_amd64.whl
其它版本的whl 可以自行去网上搜索
参考链接:https://www.centosdoc.com/dev/python/312.html
https://www.e-learn.cn/content/python/2360819
https://www.cnblogs.com/Elaine1/p/10180260.html
https://blog.****.net/HW140701/article/details/93494869