Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCrypto not fully installed on Windows XP

I ran python setup.py install in a Windows XP console, and it reported as follows:

running install running build running build_py running build_ext warning: GMP library not found; Not building Crypto.PublicKey._fastmath. building 'Crypto.Random.OSRNG.winrandom' extension error: None 

When I try to run a script with import Crypto.Cipher.AES, it doesn't work, saying:

ImportError: cannot import name AES 

How can I fix this?

like image 392
jay Avatar asked Nov 06 '09 12:11

jay


People also ask

How do I run PyCrypto?

PyCrypto is written and tested using Python version 2.1 through 3.3. Python 1.5. 2 is not supported. The modules are packaged using the Distutils, so you can simply run “python setup.py build” to build the package, and “python setup.py install” to install it.


2 Answers

On windows, it may just be easier installing PyCrypto via a prebuilt windows installer. The Voidspace site has PyCrypto 2.1 and 2.3 installers for Python 2.2-2.7.

like image 143
John Paulett Avatar answered Sep 30 '22 21:09

John Paulett


For other people like me on 64 bit windows 7:

Short version: Follow this instructions.

Long version:

Install VC++ 2008 SP1 Express. you can get it from here.

You also need the Windows SDK, specifically the Win7 + Net 3.5 SDK.

Maybe the issue was already solved in your python version, if not get the diff file from the issue page

download patch.py (or any other tool to patch diff files)

if you downloaded the patch.py and diff file in c:\Python27 just run:

python patch-11.01.py vcvars3.diff 

Finally install using pip:

pip install pycrypto 
like image 44
tovmeod Avatar answered Sep 30 '22 22:09

tovmeod