2010-06-24 15 views
17

Estoy intentando construir e instalar M2Crypto en Ubuntu 10.04 LTS. Descargué y desactivé M2Crypto-0.20.2.tar, y desde el directorio M2Crypto-0.20.2 probé python setup.py build. Recibí un error porque no tengo trago. Así que ejecuté sudo apt-get install swig. Luego probé python setup.py build de nuevo y tengo:¿Cómo instalo M2Crypto en Ubuntu?

/usr/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'test_suite' 
    warnings.warn(msg) 
running build 
running build_py 
running build_ext 
building 'M2Crypto.__m2crypto' extension 
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c 
swig -python -I/usr/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i 
SWIG/_bio.i:64: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_rand.i:19: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_evp.i:156: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_dh.i:36: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_rsa.i:43: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_dsa.i:31: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_ssl.i:207: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_x509.i:313: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_pkcs7.i:42: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_pkcs7.i:42: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_util.i:9: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_ec.i:111: Warning(454): Setting a pointer/reference variable may leak memory. 
SWIG/_engine.i:162: Warning(454): Setting a pointer/reference variable may leak memory. 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -I/usr/include -I/home/dspitzer/M2Crypto-0.20.2/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-i686-2.6/SWIG/_m2crypto_wrap.o -DTHREADING 
SWIG/_m2crypto_wrap.c:126:20: error: Python.h: No such file or directory 
SWIG/_m2crypto_wrap.c:757: error: expected ‘)’ before ‘*’ token 
SWIG/_m2crypto_wrap.c:781: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token 

... y así sucesivamente.

¿Alguien ha tenido éxito al hacer esto?

Actualización: Cambié el título, ya que no se me ocurrió que M2Crypto sería un paquete de Ubuntu previo a la compilación.

+0

Eso simplemente no se me ocurrió. Funcionó como debería. Si metes tu comentario en una respuesta, lo aceptaré. –

Respuesta

27

Es probable que tenga que instalar los paquetes de desarrollo de Python:

sudo apt-get install python-dev 

Mejor aún, no se moleste edificio M2Crypto mismo. Ya es in the Ubuntu repositories como un paquete totalmente compatible. De esta manera, obtendrá actualizaciones automáticas por los mismos medios que el resto de su sistema Ubuntu:

sudo apt-get install python-m2crypto 
+0

Desafortunadamente, M2Crypto no ha sido portado a Python 3, sin embargo :( – bitek

3

¿tiene instalado el paquete python2.6-dev? Este es el paquete que contiene el archivo Python.h se echa en falta