Microsoft Windows Python-3.6 PyCrypto installation error

The file include\pyport.h in Python installation directory does not have #include < stdint.h > anymore. This leaves intmax_t undefined.

A workaround for Microsoft VC compiler is to force include stdint.h via OS environment variable CL:

  1. Open command prompt
  2. Setup VC environment by runing vcvars*.bat (choose file name depending on VC version and architecture)
  3. set CL=-FI"Full-Path\stdint.h" (use real value for Full-Path for the environment)
  4. pip install pycrypto

I've succeeded install pycrypto 2.6.1 on python 3.6, Windows 10, Visual Studio 2017.

  1. Open "x86_x64 Cross-Tools Command Prompt for VS 2017" with administrator privilege in start menu.

  2. set CL=-FI"%VCINSTALLDIR%Tools\MSVC\14.11.25503\include\stdint.h"

  3. pip install pycrypto

enter image description here


Thanks to user1960422's answer.
PowerShell steps for pycrypto 2.6.1 (via simple-crypt) / Python 3.6 / Windows 10:

$env:VCINSTALLDIR="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
$env:CL="-FI`"$env:VCINSTALLDIR\INCLUDE\stdint.h`""

Successful simple-crypt / pycrypto install

I also needed to follow the answer in: https://stackoverflow.com/a/24822876/8751739 to fix a winrandom module error.