Today you are ready to install a Pycrypto 2.6.1 module on a Windows system based on python3.6, unfortunately reporting a bunch of errors as follows:
Running Install
Running Build
Running Build_py
Running Build_ext
Warning:gmp or Mpir library not found; Not building Crypto.publickey._fastmath.
Building ' Crypto.Random.OSRNG.winrandom ' extension
C:\Program Files (x86) \microsoft Visual Studio 14.0\vc\bin\x86_amd64\cl.exe/c/nologo/ox/w3/gl/dndebug/md-isrc/-is Rc/inc-msvc/-ic:\python36\include-ic:\python36\include
Winrand.c
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h (+): Error C2061:syntax Error:identifier ' intmax_t '
C:\Program Files (x86) \ Kits\10\include\10.0.10240.0\ucrt\inttypes.h (+): Error C2061:syntax Error:identifier ' REM '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h: Error c2059:syntax error: '; '
C:\Program Files (x86) \ Kits\10\include\10.0.10240.0\ucrt\inttypes.h (): Error c2059:syntax error: '} '
C:\Program Files (x86) \ Kits\10\include\10.0.10240.0\ucrt\inttypes.h (+): Error C2061:syntax Error:identifier ' imaxdiv_t '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h (+): Error c2059:syntax error: '; '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h (+): Error c2143:syntax error:missing ' {' Before ' __cdecl '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h (in): Error c2146:syntax error:missing ') ' Before identifier ' _number '
C:\Program Files (x86) \ Kits\10\include\10.0.10240.0\ucrt\inttypes.h ($): Error C2061:syntax Error:identifier ' _number '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h (in): Error c2059:syntax error: '; '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h: Error C2059:syntax Error: ') '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h: Error C2143:syntax error:missing ' {' Before ' __cdecl '
C:\Program Files (x86) \ Windows kits\10\include\10.0.10240.0\ucrt\inttypes.h (*): Error c2146:syntax error:missing ') ' Before identifier ' _numerator '
C:\Program Files (x86) \ Kits\10\include\10.0.10240.0\ucrt\inttypes.h (+): Error C2061:syntax Error:identifier ' _numerator '
C:\Program Files (x86) \ Windows kits\10\include\10.0.10240.0\ucrt\inttypes.h (*): Error c2059:syntax error: '; '
C:\Program Files (x86) \ Windows kits\10\include\10.0.10240.0\ucrt\inttypes.h (*): Error c2059:syntax Error: ', '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h ($): Error C2059:syntax Error: ') '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h (): Error C2143:syntax error:missing ' {' Before ' __cdecl '
C:\Program Files (x86) \ Windows kits\10\include\10.0.10240.0\ucrt\inttypes.h (*): Error c2143:syntax error:missing ' {' Before ' __cdecl '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h (in): Error C2143:syntax error:missing ' {' Before ' __cdecl '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h (a): Error c2143:syntax error:missing ' {' Before ' __cdecl '
C:\Program Files (x86) \ Windows kits\10\include\10.0.10240.0\ucrt\inttypes.h (*): Error c2143:syntax error:missing ' {' Before ' __cdecl '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h (a): Error c2143:syntax error:missing ' {' Before ' __cdecl '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h (in): Error C2143:syntax error:missing ' {' Before ' __cdecl '
C:\Program Files (x86) \ Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.h ($): 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 Statu S 2
After some Baidu and Google and try to finally successfully install Pycrypto 2.6.1, the specific solution is as follows:
Set the environment variables for Microsoft Visual Studio 14.0
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/9D/31/wKioL1l7HiXSMl-MAACx6J9oVmM392.png-wh_500x0-wm_ 3-wmp_4-s_1855214517.png "title=" Qq20170728190334.png "alt=" Wkiol1l7hixsml-maacx6j9ovmm392.png-wh_50 "/>
Open cmd and execute the following command: Set Cl=/fi "%vcinstalldir%\\include\\stdint.h"%cl%
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/9D/31/wKiom1l7Ht3As0GsAAAWuxt8dkg798.png-wh_500x0-wm_ 3-wmp_4-s_2686756336.png "title=" Qq20170728192331.png "alt=" Wkiom1l7ht3as0gsaaawuxt8dkg798.png-wh_50 "/>
Reinstall Pycrypto 2.6.1
Enter Pycrypto 2.6.1 directory via cmd, execute python setup.py install
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/9D/31/wKiom1l7H0STYkyYAAAHm40lII4024.png-wh_500x0-wm_ 3-wmp_4-s_4142096835.png "title=" Qq20170728192505.png "alt=" Wkiom1l7h0stykyyaaahm40lii4024.png-wh_50 "/>
The results are as follows:
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/9D/31/wKiom1l7H2CSSxxOAACZPVGXsMU409.png-wh_500x0-wm_ 3-wmp_4-s_2300027053.png "title=" Qq20170728190548.png "alt=" Wkiom1l7h2cssxxoaaczpvgxsmu409.png-wh_50 "/>
Successfully installed Pycrypto 2.6.1 ....
Windows7 Python-3.6 installation Pycrypto (Pycrypto 2.6.1) Error and workaround