2009-11-06 17 views
29

J'ai couru python setup.py install dans une console Windows XP, et il a indiqué comme suit:PyCrypto pas complètement installé sur Windows XP

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 

Lorsque je tente d'exécuter un script avec import Crypto.Cipher.AES, il ne fonctionne pas, en disant:

ImportError: cannot import name AES 

Comment puis-je résoudre ce problème?

Répondre

43

Sur Windows, il peut être plus simple d'installer PyCrypto via un programme d'installation de fenêtres prédéfini. Le site Espace vide contient PyCrypto 2.1 and 2.3 installers for Python 2.2-2.7.

+0

ça a marché! Merci. – jay

+0

pas de version pour win64 :( – tovmeod

+1

La version PyCrypto 2.6 de Voidspace inclut des versions 32 bits et 64 bits pour chaque version de Python supportée –

0

Vous pouvez utiliser PyPM installer (paquet binaire pré-construit de) pycrypto:

C:> pypm install pycrypto 
Ready to perform these actions: 
The following packages will be installed: 
pycrypto-2.0.1 
Get: [pypm.activestate.com] pycrypto 2.0.1-1 
Installing pycrypto-2.0.1 

Pour lister les fichiers installés, tapez:

C:> pypm files pycrypto 
C:\Users\sridharr\AppData\Roaming\Python\Python26 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher\AES.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher\ARC2.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher\ARC4.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher\Blowfish.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher\CAST.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher\DES.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher\DES3.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher\IDEA.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher\RC5.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher\XOR.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Cipher\__init__.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Hash 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Hash\HMAC.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Hash\MD2.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Hash\MD4.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Hash\MD5.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Hash\RIPEMD.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Hash\SHA.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Hash\SHA256.pyd 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Hash\__init__.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Protocol 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Protocol\AllOrNothing.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Protocol\Chaffing.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Protocol\__init__.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\PublicKey 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\PublicKey\DSA.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\PublicKey\ElGamal.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\PublicKey\RSA.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\PublicKey\__init__.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\PublicKey\pubkey.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\PublicKey\qNEW.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Util 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Util\RFC1751.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Util\__init__.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Util\number.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Util\randpool.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\Util\test.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\__init__.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\Crypto\test.py 
C:\Users\sridharr\AppData\Roaming\Python\Python26\site-packages\pycrypto-2.0.1-py2.6.egg-info 

PyPM peut être installé en installant ActivePython.

+1

_error: Can ' t installez pycrypto-2.5: nécessite l'abonnement Business Edition_ –

+1

@DavidFreitas - essayez ActivePython 32 bits, pas 64 bits. –

3

Pour d'autres personnes comme moi sur 64 bit windows 7:

Version courte: Suivez this instructions.

Version longue:

Installer VC++ 2008 SP1 Express. vous pouvez l'obtenir à partir de here.

Vous avez également besoin du SDK Windows, en particulier le Win7 + Net 3.5 SDK.

Peut-être que le issue a déjà été résolu dans la version python, sinon obtenir le fichier diff de la page d'émission

télécharger patch.py (ou tout autre outil pour patcher les fichiers diff)

si vous avez téléchargé le patch py et le fichier diff dans c:\Python27 il suffit d'exécuter:

python patch-11.01.py vcvars3.diff 

Enfin installer à l'aide pip:

pip install pycrypto