How to install Pycrypto for Python 3.7.2?

Ben_r007 picture Ben_r007 · Jan 11, 2019 · Viewed 12.8k times · Source

When installing Pycrypto, a compiler error occurs

I need to install Pycrypto thrue pip install

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isrc/ -Isrc/inc-msvc/ -Id:\gametest\include -IC:\Python37\include -IC:\Python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /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.17763.0\ucrt\inttypes.h(27): error C2061: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : Ё¤Ґ­вЁдЁЄ в®а "intmax_t"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(28): error C2061: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : Ё¤Ґ­вЁдЁЄ в®а "rem"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(28): error C2059: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ;
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(29): error C2059: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : }
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(31): error C2061: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : Ё¤Ґ­вЁдЁЄ в®а "imaxdiv_t"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(31): error C2059: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ;
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(41): error C2143: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ "{" ЇҐаҐ¤ "__cdecl"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(42): error C2146: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ ")" ЇҐаҐ¤ Ё¤Ґ­вЁдЁЄ в®а®¬ "_Number"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(42): error C2061: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : Ё¤Ґ­вЁдЁЄ в®а "_Number"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(42): error C2059: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ;
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(43): error C2059: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : )
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(46): error C2143: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ "{" ЇҐаҐ¤ "__cdecl"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2146: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ ")" ЇҐаҐ¤ Ё¤Ґ­вЁдЁЄ в®а®¬ "_Numerator"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2061: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : Ё¤Ґ­вЁдЁЄ в®а "_Numerator"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2059: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ;
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2059: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ,
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(49): error C2059: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : )
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(51): error C2143: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ "{" ЇҐаҐ¤ "__cdecl"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(57): error C2143: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ "{" ЇҐаҐ¤ "__cdecl"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(64): error C2143: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ "{" ЇҐаҐ¤ "__cdecl"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(70): error C2143: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ "{" ЇҐаҐ¤ "__cdecl"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(77): error C2143: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ "{" ЇҐаҐ¤ "__cdecl"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(83): error C2143: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ "{" ЇҐаҐ¤ "__cdecl"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(90): error C2143: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ "{" ЇҐаҐ¤ "__cdecl"
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(96): error C2143: бЁ­в ЄбЁзҐбЄ п ®иЁЎЄ : ®вбгвбвўЁҐ "{" ЇҐаҐ¤ "__cdecl"
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

----------------------------------------
Command 
"d:\gametest\scripts\python.exe -u -c "import setuptools, tokenize;__file__=
'C:\\Users\\John\\AppData\\Local\\Temp\\pip-install-59ujdaeb\\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\John\AppData\Local\Temp\pip-record-0_6xj1_v\install-record.txt 
--single-version-externally-managed --compile --install-headers d:\gametest
\include\site\python3.7\pycrypto" failed with error code 1 in C:\Users
\John\AppData\Local\Temp\pip-install-59ujdaeb\pycrypto\

Visual Studio installed

Answer

frankegoesdown picture frankegoesdown · Jan 11, 2019

pip install pycryptodome It is a pycrypto fork with new features and it supports wheel. It replaces pycrypto https://pycryptodome.readthedocs.org/en/latest/src/examples.html