python Crypto 包安装

经测试使用 pip install pycrypto安装会出现,如下所示错误:

pip install pycrypto -i https://pypi.douban.com/simple/
Looking in indexes: https://pypi.douban.com/simple/
Collecting pycrypto
  Using cached https://pypi.doubanio.com/packages/60/db/645aa9af249f059cc3a368b118de33889219e0362141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz (446 kB)
  Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for pycrypto, since package 'wheel' is not installed.
Installing collected packages: pycrypto
    Running setup.py install for pycrypto ... error
    ERROR: Command errored out with exit status 1:
     command: 'd:\program files\python_3_6\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-sfprn7aa\\pycrypto_f79da88d14cb414aa0c543e5152117fc\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-sfprn7aa\\pycrypto_f79da88d14cb414aa0c543e5152117fc\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-19gfpf0f\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\program files\python_3_6\Include\pycrypto'
         cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-sfprn7aa\pycrypto_f79da88d14cb414aa0c543e5152117fc\
    Complete output (183 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.6
    creating build\lib.win32-3.6\Crypto
    copying lib\Crypto\pct_warnings.py -> build\lib.win32-3.6\Crypto
    copying lib\Crypto\__init__.py -> build\lib.win32-3.6\Crypto
    creating build\lib.win32-3.6\Crypto\Hash
    copying lib\Crypto\Hash\hashalgo.py -> build\lib.win32-3.6\Crypto\Hash
    copying lib\Crypto\Hash\HMAC.py -> build\lib.win32-3.6\Crypto\Hash
    copying lib\Crypto\Hash\MD2.py -> build\lib.win32-3.6\Crypto\Hash
    ......
    winrand.c
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(31): error C2061: 语法错误: 标识符“intmax_t”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(32): error C2061: 语法错误: 标识符“rem”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(32): error C2059: 语法错误:“;”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(33): error C2059: 语法错误:“}”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(35): error C2061: 语法错误: 标识符“imaxdiv_t”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(35): error C2059: 语法错误:“;”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(45): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(46): error C2146: 语法错误: 缺少“)”(在标识符“_Number”的
前面)
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(46): error C2061: 语法错误: 标识符“_Number”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(46): error C2059: 语法错误:“;”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(47): error C2059: 语法错误:“)”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(50): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(51): error C2146: 语法错误: 缺少“)”(在标识符“_Numerator
”的前面)
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(51): error C2061: 语法错误: 标识符“_Numerator”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(51): error C2059: 语法错误:“;”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(51): error C2059: 语法错误:“,”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(53): error C2059: 语法错误:“)”
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(55): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(61): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(68): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(74): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(81): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(87): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(94): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
    C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\inttypes.h(100): error C2143: 语法错误: 缺少“{”(在“__cdecl”的前面)
    error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.35.32215\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\program files\python_3_6\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-sfprn7aa\\pycrypto_f79da88d14cb414aa0c543e5152117fc\\setup.py'"'"'; __file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-sfprn7aa\\pycrypto_f79da88d14cb414aa0c543e5152117fc\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-19gfpf0f\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\program files\python_3_6\Include\pycrypto' Check the logs for full command output.

后来到 https://www.pycrypto.org/ 发现可使用 pip install pycryptodome 安装 pycryptodome,程序中即可使用 Crypto 包。

你可能感兴趣的:(Python,python,开发语言)