Cómo instalar lxml en Ubuntu
Estoy teniendo dificultades para instalar lxml con easy_install en Ubuntu 11.
Cuando escribo $ easy_install lxml
obtengo:
Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.3
Downloading http://lxml.de/files/lxml-2.3.tgz
Processing lxml-2.3.tgz
Running lxml-2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-7UdQOZ/lxml-2.3/egg-dist-tmp-GacQGy
Building lxml version 2.3.
Building without Cython.
ERROR: /bin/sh: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
In file included from src/lxml/lxml.etree.c:227:0:
src/lxml/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory
compilation terminated.
Parece que libxslt
o libxml2
no está instalado. He intentado seguir las instrucciones en http://www.techsww.com/tutorials/libraries/libxslt/installation/installing_libxslt_on_ubuntu_linux.php y http://www.techsww.com/tutorials/libraries/libxml/installation/installing_libxml_on_ubuntu_linux.php sin éxito.
Si lo intento wget ftp://xmlsoft.org/libxml2/libxml2-sources-2.6.27.tar.gz
Consigo
<successful connection info>
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /libxml2 ... done.
==> SIZE libxml2-sources-2.6.27.tar.gz ... done.
==> PASV ... done. ==> RETR libxml2-sources-2.6.27.tar.gz ...
No such file `libxml2-sources-2.6.27.tar.gz'.
Si pruebo el otro primero, llegaré a ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2
y eso fallará eventualmente con:
checking for libxml libraries >= 2.6.27... configure: error: Could not find libxml2 anywhere, check ftp://xmlsoft.org/.
He probado ambas versiones 2.6.27
y 2.6.29
de libxml2
sin diferencia.
No dejando piedra sin remover, he hecho con éxito sudo apt-get install libxml2-dev
, pero esto no cambia nada.
9 answers
Ya que estás en Ubuntu, no te molestes con esos paquetes fuente. Simplemente instale esos paquetes de desarrollo usando apt-get.
apt-get install libxml2-dev libxslt1-dev python-dev
Si estás satisfecho con una versión posiblemente más antigua de lxml, puedes probar
apt-get install python-lxml
Y termina con esto. :)
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-04-02 23:30:17
También tuve que instalar lib32z1-dev antes de que lxml compilara (Ubuntu 13.04 x64).
sudo apt-get install lib32z1-dev
O todos los paquetes requeridos juntos:
sudo apt-get install libxml2-dev libxslt-dev python-dev lib32z1-dev
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-06-21 23:51:53
Como @ Pepijn comentó en la respuesta de @Druska, en ubuntu 13.04 x64, no hay necesidad de usar lib32z1-dev, zlib1g - dev es suficiente:
sudo apt-get install libxml2-dev libxslt-dev python-dev zlib1g-dev
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-08 00:37:50
Instalé lxml con pip en Vagrant, usando Ubuntu 14.04 y tuve el mismo problema. A pesar de que todos los requisitos fueron instalados, obtuve el mismo error una y otra vez. Resultó que mi VM tenía poca memoria por defecto. Con 1024 MB todo funciona bien.
Agregue esto a su VagrantFile y lxml debería compilar / instalar correctamente:
config.vm.provider "virtualbox" do |vb|
vb.memory = 1024
end
Gracias a sixhobbit por la pista (ver: no se puede instalar lxml en Ubuntu 12.04).
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 11:47:21
Para Ubuntu 14.04
sudo apt-get install python-lxml
Funcionó para mí.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-01 09:32:47
Después de instalar los paquetes mencionados por AKX todavía tenía el mismo problema. Solucionado con
apt-get install python-dev
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-08 00:38:00
Paso 1
Instale las últimas actualizaciones de python usando este comando.
sudo apt-get install python-dev
Paso 2
Añadir la primera dependencia libxml2 versión 2.7.0 o posterior
sudo apt-get install libxml2-dev
Paso 3
Añadir segunda dependencia libxslt versión 1.1.23 o posterior
sudo apt-get install libxslt1-dev
Paso 4
Instalar pip herramienta de gestión de paquetes primero. y ejecuta este comando.
pip install lxml
Si tiene alguna duda Haga clic aquí
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-11 04:19:18
Para Ubuntu 12.04.3 LTS (Pangolín preciso) tuve que hacer:
apt-get install libxml2-dev libxslt1-dev
(Note el "1" en libxslt1-dev)
Entonces acabo de instalar lxml con pip/easy_install.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-09-10 18:40:20
Primero instale el paquete python-lxml
de Ubuntu y sus dependencias:
sudo apt-get install python-lxml
Luego use pip
para actualizar a la última versión de lxml para Python:
pip install lxml
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-01-27 10:26:31