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

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

Nov 10

Posted by alesk

This note is 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 that I first tried to build pycrypto with MinGW using TLDR experimental installation package for Windows x64. Making long story short, it was a bummer (I hit several errors that I didn’t know how to resolve), I didn’t even try if 32-bit module could be compiled with MinGW. Anyway, I believe sticking with VC 2008 and bulky SDK (over 5GB of installed SW!) is inevitable, at least for me. Here’re the steps that I followed….

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

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

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

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

Again, don’t be tempted to install newer Windows SDK for Windows 7 and .NET 4, it must be 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 you 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 on 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 that it works:

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

时间: 2024-11-05 23:18:52

How to compile pycrypto 2.4.1 (python 3.2.2 for Windows 7 x64)的相关文章

将python的程序包装成windows下的service

使用python编写的脚本应用程序,在运行的时候需要有python的运行环境,但是我们肯定是希望整个python程序能够像应用程序一样打包生成一个包括其运行环境的exe文件包,这是第一步,但是要想使用net start这样的方式启动, 还需要将该exe注册到服务里面去,使用exe install完成. ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 #SmallestService.py 

在SAE搭建Python+Django+MySQL(基于Windows)

为了与时俱进,工作闲余开始研究Python,刚一接触就被Python这"优雅"的语法吸引住!后来接触到了Django,虽然还没有太深入的研究,但对这种新概念的WEB开发很感兴趣,决定尝试用它代替Java开发小的后台程序,边用边学吧! 注:本篇只介绍基础搭建过程,不负责讲解,因为刚接触Python我也不懂! 一.SAE使用的Python环境版本 Python2.7 Django1.27 / 1.4 / 1.5 本地版本要确定好,需要用到其他的预装模块也要确定好. (我一开始使用了高版本的

test Python source code plugin with Windows live writter 2012–

内容介绍ZT: http://www.cnblogs.com/liuxianan/archive/2013/04/13/3018732.html 博客园官方给出了2个,一个一个介绍. 1.WindowsLiveWriter.CNBlogs.CodeHighlighter.rar 这个插件生成的高亮代码与网页上的一模一样,插入后即可立即显示效果,不过貌似它必须联网才能实时显示效果,因为博客园官方说这是基于“云处理”的.安装方法很简单,将上面的压缩包解压然后复制里面的文件到: C:\Program

(2)在Windows 7 x64端设置Python环境

因Python语言在大数据处理,以及科学计算方向的雄起,另Django等Web框架已经在业界获得共识多年,所以本文拟搭建Python的学习开发环境.由于本人的笔记本及实验室主机系统环境以Windows为主,所以本文意在搭建Windows环境下的Python开发环境. 本文的内容主要分为以下几个部分:1.寻找合适的IDE:2.搭建Django:3.搭建Numpy+matplotlib+Scipy环境 *************************************************

Selenium用Python的第一个示例 (Windows系统)

Install Python (https://www.python.org/),download the latest Python version Configure environment variables. (Example), I installed Python under /installation folder with Python 3.5.2. The path set is as follows: D:\installation\Python3.5.2;D:\instal

怎样将python的文件转化为windows的可执行程序

最近我在刚入手python,其中就学到了怎样将python的py格式文件转化为windows的exe执行程序, 是这样的,首先要创建一个py文件,这里给截图吧 接下来就以这个python文件为例创建一个find_day.exe文件. 首先,我们要去http://www.py2exe.org下载py2exe, 这里点击Downloade py2exe from SourceForge, 这里,我们点击下载win32-py2.7.exe进行下载,之后安装,安装目录为python的所在目录. 现在创建

python拷贝文件小程序(windows)

1 #!/usr/bin/python 2 3 import os 4 5 source='F:\\lh.jpg' 6 target='E:\\' 7 copy_command="xcopy %s %s"%(source,target) 8 print copy_command 9 if os.system(copy_command)==0: 10 print 'Successful copy to',target 11 else: 12 print 'Copy FAILED' 把文件

python输出中文——如何在Windows控制台打印不乱码

文章介绍 用Python在控制台打印中文如何不会乱码,一直是困扰很多Pythoner的问题,甚至很多Python老手也经常犯难.原因就在于从一般网页.数据库或文本外来数据源上抓取过来的内容,需要经过正确的编解码才可以正常输出,而Python的编解码机制比较复杂,没有深入思考的话经常遇到调试错误.这篇文章介绍了最常见的几种输出中文的情况,编译平台为Windows控制台,Python版本为2.7.9 文章中一些内容参考了点击打开链接 感谢原作者分享. 预备知识 str和unicode 首先需要弄清楚

[C++/Python] 如何在Python中使用一个DLL? (Windows环境)

开发环境VS2012, WIN7 64. 首先生成的DLL大致如下: .h文件 #ifdef CVINPYTHON_EXPORTS #define CVINPYTHON_API __declspec(dllexport) #else #define CVINPYTHON_API __declspec(dllimport) #endif extern "C" { CVINPYTHON_API int addinPython(int, int); }; .c文件 #include &quo