How to compile Pycrypto 2.4.1 (python 3.2.2 for Windows 7 x64)

Source: Internet
Author: User
Tags windows 7 x64 windows x64

How to compile Pycrypto 2.4.1 (python 3.2.2 for Windows 7 x64)

Nov 10

Posted by Alesk

This note was a variation of note that talks about compiling cx_oracle module for Python 3.2 (64-bit), but this time around I wanted to try out Pycrypto module v2.4.1 that supports Python 3. Let me say this I first tried to build Pycrypto with MinGW using TLDR experimental installation The package for Windows x64. Making Long story short, it is a bummer (I-hit several errors that I-didn ' t knowhow to resolve), I didn ' t even Try if 32-bit module could is compiled with MinGW. Anyway, I believe sticking with VC/bulky SDK (over 5GB of installed sw!) are inevitable, at least for me. Here's re the steps that I followed ....

My target platform for the Pycrypto build is Windows 7 Professional x64 (SP1) with 64-bit python 3.2.2.

1) Download and install Visual Studio Express SP1 from MS site

It ' s mandatory to build Python modules with VC, because this is the compiler that was used
To build Python 3.2. Note that I installed the default components of the Visual Studio in the default location.

2) Because Visual Studio Express SP1 doesn ' t ship with 64-bit compiler, download
and install Windows SDK for Windows 7 and. NET 3.5 SP1
.

Again, Don's is tempted to the install newer Windows SDK for Windows 7 and. NET 4, it must is older SDK (released in 2009). I left all installation options at default.

3) Download and install 64-bit python 3.2.2

Ok, this is obvious step. :-)

4) Download Pycrypto 2.4.1

After your download unzip pycrypto-2.4.1.tar.gz in some temporary directory, such as C:\Temp

5) Prepare command shell for 64-bit compiler:

Start -> Run

%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat""

Then enter the following in the command line:

SET PATH=C:\PYTHON32;%PATH%

SET pythonhome=c:\python32\

CD C:\Temp\pycrypto-2.4.1

Python setup.py Build

python setup.py bdist_wininst

In dist directory you ' ll find installation file:

pycrypto-2.4.1.win-amd64-py3.2.exe

After you install Pycrypto, check the It works:

cmd> python
>>> import Crypto
>>> print(Crypto.__version__)
2.4.1

How to compile Pycrypto 2.4.1 (python 3.2.2 for Windows 7 x64)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.