win10下Python安装pycrypto报错

错误一:  error: Microsoft Visual C++ 14.0 is required.

解决办法:

原文 https://blog.csdn.net/heyshheyou/article/details/82022948

错误二: 语法错误: 标识符“intmax_t”

解决办法

        32位

        cd C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuild      注  Community需要换成自己系统的值 比如我的是  Enterprise

        vcvarsall.bat  x86_amd64 

        set CL=-FI"%VCToolsInstallDir%includestdint.h

        pip install pycrypto

        

        64位

        cd C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuild       注  Community需要换成自己系统的值 比如我的是  Enterprise

        vcvarsall.bat x64

        set CL=-FI"%VCToolsInstallDir%includestdint.h

        pip install pycrypto

===============================================================================

附完整的错误提示: 

1、python环境   

    >python -V

    Python 3.7.0

2、pip install pycrypto报错如下 

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    27): error C2061: 语法错误: 标识符“intmax_t”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    28): error C2061: 语法错误: 标识符“rem”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    28): error C2059: 语法错误:“;”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    29): error C2059: 语法错误:“}”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    31): error C2061: 语法错误: 标识符“imaxdiv_t”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

        31): error C2059: 语法错误:“;”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    41): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    42): error C2146: 语法错误: 缺少“)”(在标识符“_Number”的前面)

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    42): error C2061: 语法错误: 标识符“_Number”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    42): error C2059: 语法错误:“;”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    43): error C2059: 语法错误:“)”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    46): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    47): error C2146: 语法错误: 缺少“)”(在标识符“_Numerator”的前面)

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    47): error C2061: 语法错误: 标识符“_Numerator”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    47): error C2059: 语法错误:“;”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

        47): error C2059: 语法错误:“,”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    49): error C2059: 语法错误:“)”

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    51): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    57): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    64): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    70): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    77): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    83): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.h(

    90): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)

        C:Program Files (x86)Windows Kits10include10.0.17134.0ucrtinttypes.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:python37python.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(' ', ' '

    );f.close();exec(compile(code, __file__, 'exec'))" install –record C:UsersADM

    INI~1AppDataLocalTemppip-record-xxn48yyzinstall-record.txt –single-version

    -externally-managed –compile" failed with error code 1 in C:UsersADMINI~1App

    DataLocalTemppip-install-bf6lznwzpycrypto

==================================================================================

 错误三、以上办法均使用,仍然不好使,去网上找对应版本的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.csdn.net/HW140701/article/details/93494869

原文地址:https://www.cnblogs.com/xiohao/p/11216271.html