2009-11-06 5 views
29

correvo python setup.py install in una console di Windows XP, ed è riportato come segue:pycrypto non completamente installati su 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 

Quando provo ad eseguire uno script con import Crypto.Cipher.AES, non funziona, dicendo:

ImportError: cannot import name AES 

Come posso risolvere questo problema?

risposta

43

Su Windows, potrebbe essere più semplice installare PyCrypto tramite un programma di installazione Windows preinstallato. Il sito Voidspace ha PyCrypto 2.1 and 2.3 installers for Python 2.2-2.7.

+0

ha funzionato! Grazie. – jay

+0

nessuna versione per win64 :( – tovmeod

+1

La versione PyCrypto 2.6 di Voidspace include build a 32 e 64 bit per ogni versione Python supportata –

0

È possibile utilizzare PyPM installare (pre-costruito pacchetto binario di) 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 

Per elencare i file installati, tipo:

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 può essere installato con l'installazione di ActivePython.

+1

_error: Can ' t installa pycrypto-2.5: richiede abbonamento Business Edition –

+1

@DavidFreitas - prova ActivePython a 32 bit, non a 64 bit. –

3

Per le altre persone come me a 64 bit di Windows 7:

Versione corta: Seguire this istruzioni.

Versione lunga:

Installare VC++ 2008 SP1 Express. puoi ottenerlo dal here.

È inoltre necessario l'SDK di Windows, in particolare lo Win7 + Net 3.5 SDK.

Forse il issue è stato già risolto nella versione python, se non ottenere il file diff dalla pagina problema

scaricare patch.py (o qualsiasi altro strumento per correggere i file diff)

se avete scaricato la patch .py e diff file in c:\Python27 basta eseguire:

python patch-11.01.py vcvars3.diff 

Infine installazione utilizzando pip:

pip install pycrypto