2011-01-10 23 views
32

He instalado Python 2.6.6 en CentOS 5.4,Setup.py: instalar lxml con Python2.6 en CentOS

[[email protected] lxml-2.3beta1]$ python 
Python 2.6.6 (r266:84292, Jan 4 2011, 09:49:55) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 

Quiero usar el módulo lxml, pero construyo a partir de fuentes no:

src/lxml/lxml.etree.c:157929: error: ‘xsltLibxsltVersion’ undeclared (first use in this function) 
src/lxml/lxml.etree.c:157941: error: ‘__pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER’ undeclared (first use in this function) 
src/lxml/lxml.etree.c:157941: error: ‘xsltDocDefaultLoader’ undeclared (first use in this function) 
src/lxml/lxml.etree.c:157950: error: ‘__pyx_f_4lxml_5etree__xslt_doc_loader’ undeclared (first use in this function) 
error: command 'gcc' failed with exit status 1 
+0

¿Qué versión de las cabeceras libxslt están instalados en la máquina? – Mic

Respuesta

53

que tenían el mismo problema, he logrado instalarlo después de instalar el paquete libxslt-devel y python-devel que parece ser su problema:

yum install libxslt-devel python-devel

python setup.py install

Installed /usr/lib/python2.6/site-packages/lxml-2.2.8-py2.6-linux-i686.egg 
Processing dependencies for lxml==2.2.8 
Finished processing dependencies for lxml==2.2.8 

Sin embargo desde que instaló también otros paquetes en el proceso, es posible que desee volver a comprobar libxml2, libxml2-devel y libxslt mientras usted está en él.

Aquí hay alguna información sobre cómo construir lxml: http://lxml.de/build.html

+7

aquí muchas gracias ~ 1 $ sudo yum install libxslt-devel 2. $ sudo easy_install lxml y funciona ~ – znetor

+0

Sólo como referencia - mismo problema en Ubuntu fija con -> apt-get install libxslt1-dev –

+1

python-devel en CentOS (python-dev en ubuntu) también es obligatorio. – surfeurX

3

Se resolvió mi problema para nokogiri en Centos

sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel 
0

estas obras para mí

yum -y install python-devel gcc libxml2 libxml2-devel libxslt libxslt-devel 

especialmente la python-devel

0

Si lo siguiente no funciona

sudo yum install libxslt-devel python-devel 

probar esto

pip install -U pip setuptools 

y seguidamente coloque por

pip install lxml 
Cuestiones relacionadas