logo MSJO.kr

Install pycrypto on Windows

2020-03-25
MsJ

파이썬으로 다양한 encryption algorithms(AES, DES, RSA, …)을 구현하기 위해 pycrypto 패키지를 설치해야 하는 데 문제는 Windows에서 설치 에러가 종종 발생한다. Microsoft Windows에서 이를 해결하기 위해서는 Visual Studio에 C++ 컴파일 환경이 필요하다. 우선 VS2017 또는 VS2019 설치(C++포함)하고 PIP로 파이썬에 pycrypto 패키지를 추가한 후 ‘nt.py’(pycrypto 소스)를 수정하면 된다.

  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build 폴더로 이동 후 아래처럼 실행 (또는 2017, 32/64 구분)
vcvarsall.bat x86_amd64

cd %VCINSTALLDIR%
for /R %f in (*stdint.h) do set CL=-FI"%f"

pip install pycrypto
  • nt.py소스 수정
import winrandom 
#아래와 같이 수정
from . import winrandom
Reference

Prεv(Θld)   Nεxt(Nεw)
Content
Search     RSS Feed     BY-NC-ND