Python3.7下载安装pycrypto报错解决办法总结

在用Python3+版本中遇到下载安装pycrypto等或其他第三方插件报错的问题
(试过很多百度上的方法,什么卸载重装,什么下载whl文件,都没用,以下是总结的解决方案)

1.首先是常见error,缺少C++组件(如不是此问题,请跳过看一下一个问题):

报错内容:Microsoft Visual C++ 14.0 is required.

报错原因:组件缺失

解决办法:根据python版本下载安装不同的组件就行了,如果你用的也是 Python3.5 以上高版本,
恭喜你直接使用我这里的下载链接下载Microsoft Visual C++ 14.0就行了

链接:https://pan.baidu.com/s/1EdoNu6fESi1eStG0SOEqlg 提取码:d9oh

2.组件inttypes.h报错,错误内容:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isrc/ -Isrc/inc-msvc/ -IF:\PyCharmProjects\163
music\venv\include -IE:\SoftWare\python\include -IE:\SoftWare\python\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files
 (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um"
 "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcsrc/winrand.c /Fobuild\temp.win-amd64-3.7\Release\src/winrand.obj
    winrand.c
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(26): error C2061: syntax error: identifier 'intmax_t'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27): error C2061: syntax error: identifier 'rem'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(27): error C2059: syntax error: ';'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(28): error C2059: syntax error: '}'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(30): error C2061: syntax error: identifier 'imaxdiv_t'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(30): error C2059: syntax error: ';'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(40): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41): error C2146: syntax error: missing ')' before identifier '_Number'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41): error C2061: syntax error: identifier '_Number'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(41): error C2059: syntax error: ';'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(42): error C2059: syntax error: ')'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(45): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2146: syntax error: missing ')' before identifier '_Numerator'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2061: syntax error: identifier '_Numerator'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2059: syntax error: ';'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(46): error C2059: syntax error: ','
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(48): error C2059: syntax error: ')'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(50): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(56): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(63): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(69): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(76): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(82): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(89): error C2143: syntax error: missing '{' before '__cdecl'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h(95): error C2143: syntax error: missing '{' before '__cdecl'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "F:\PyCharmProjects\163music\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Bcats\\AppData\\Local\\Temp\\pip-install-xms_3
o39\\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\Bcats\AppData\Local\Temp\pip-record-0ht9ai30\install-record.txt --single-version-externally-managed --compile --install-headers F:\PyCharmProjects
\163music\venv\include\site\python3.7\pycrypto" failed with error code 1 in C:\Users\Bcats\AppData\Local\Temp\pip-install-xms_3o39\pycrypto\

错误原因:默认文件语法错误
解决办法(以上问题已解决的前提,安装好了Microsoft Visual Studio 14.0):

1. 找到你Microsoft Visual Studio 14.0的安装路径,并切到指定地址
Python3.7下载安装pycrypto报错解决办法总结_第1张图片

我的地址是:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include

2. 复制stdint.h文件到下面截图指定路径
例如我的地址是:C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt
Python3.7下载安装pycrypto报错解决办法总结_第2张图片
3. 然后修改这个报错地址的文件,#include 改为 #include "stdint.h"
注意是英文的双引号!!
如下图:
Python3.7下载安装pycrypto报错解决办法总结_第3张图片
最后就是再安装就成功了,上图:
在这里插入图片描述

你可能感兴趣的:(Python)