windows ERROR: Failed building wheel for pycrypto

created at 05-29-2022 views: 49

problem

Windows will report an error when installing pycrypto.

Below are some errors

Collecting pycrypto
  Downloading http://mirrors.aliyun.com/pypi/packages/60/db/645aa9af249f059cc3a368b118de33889219e0362141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz (446 kB)
     |████████████████████████████████| 446 kB 344 kB/s
Building wheels for collected packages: pycrypto
  Building wheel for pycrypto (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'd:\ProgramData\Anaconda3\envs\d2t\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\zm\\AppData\\Local\\Temp\\pip-install-trmr6taw\\pycrypto_e1aaae9b5afb410691bac391ddb2c59f\\setup.py'"'"'; __file__='"'"'C:\\Users\\zm\\AppData\\Local\\Temp\\pip-install-trmr6taw\\pycrypto_e1aaae9b5afb410691bac391ddb2c59f\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\zm\AppData\Local\Temp\pip-wheel-egkss95d'
       cwd: C:\Users\zm\AppData\Local\Temp\pip-install-trmr6taw\pycrypto_e1aaae9b5afb410691bac391ddb2c59f\
  Complete output (183 lines):

solution

  1. Go to the VC directory: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
  2. Execute vcvarsall.bat
  3. Execute set CL=-FI"%VCINSTALLDIR%\INCLUDE\stdint.h"
  4. Just install it (I installed it in the env of anaconda, so enter the env first)
pip install pycrypto
created at:05-29-2022
edited at: 05-29-2022: