Microsoft Windows Python-3.6 PyCrypto installation error

时间秒杀一切 提交于 2019-11-27 00:31:07

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

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.

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

bhuvan karuturi

Use PyCryptodome instead of pycrypto. pycrypto is discontinued and is no longer actively supported. PyCryptodome exposes almost the same API as pycrypto (source).

I've succeeded install pycrypo 2.6.1 on python 3.6 and windows 10.

  1. Set an environment variable like below.

  2. Open cmd.exe
  3. Activate virtualenv
  4. Download pycrypto 2.6.1 release from github and unzip it.
  5. set an environment variable for pycrypto set CL=/FI"%VCINSTALLDIR%\\INCLUDE\\stdint.h" %CL%
  6. Run setup command python setup.py install
  7. my result is here

I would be glad if this could be help someone.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!