Saltar al contenido

Cómo instalar lxml en Windows

Solución:

O también puede ir a la página de Python de Gohlke de Christoph y luego descargar el archivo lxml correcto. (Generalmente, como uso Python 3.4 y tengo Windows, descargo lxml-3.4.4-cp34-none-win32.whl)

Vaya a la carpeta en la que se encuentra. Haga clic en el fondo (para que no se seleccione nada), luego izquierda + clic derecho al mismo tiempo y haga clic en abrir la ventana de comandos. Luego escriba C: / Python34 / Scripts / pip install “NOMBRE DEL ARCHIVO QUE ACABA DE DESCARGAR.whl”

En este caso sería C: / Python34 / Scripts / pip install “lxml-3.4.4-cp34-none-win32.whl”

Ahora presiona enter. Esto funcionó bien para mí, y después de escribir la cita, también puede presionar la pestaña y debería completar la correcta para usted.

Primero, siguiendo los comentarios, descargué el lxml-3.4.2-cp34-none-win_amd64.whl archivo e intenté abrirlo con un pip install, pero solo me dijo que no era un archivo de rueda válido en mi sistema o algo así.

Luego, descargué el win_32 archivo y funcionó! Tal vez sea porque tengo un procesador Intel y AMD64 es, como era de esperar, solo para procesadores AMD.

Parece que hoy en 2018, lxml se puede instalar desde PyPI:

C:UsersAdministrator>"c:Program FilesPython37python.exe" -m pip install -U pip wheel setuptools
Collecting pip
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 3.3MB/s
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/5a/9b/6aebe9e2636d35d1a93772fa644c828303e1d5d124e8a88f156f42ac4b87/wheel-0.32.2-py2.py3-none-any.whl
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl (569kB)
    100% |████████████████████████████████| 573kB 2.9MB/s
Installing collected packages: pip, wheel, setuptools
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
  The script wheel.exe is installed in 'c:Program FilesPython37Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  Found existing installation: setuptools 39.0.1
    Uninstalling setuptools-39.0.1:
      Successfully uninstalled setuptools-39.0.1
Successfully installed pip-18.1 setuptools-40.4.3 wheel-0.32.2

C:UsersAdministrator>pip install lxml
Collecting lxml
  Downloading https://files.pythonhosted.org/packages/d7/9d/1aa28aa9d293a816baec6c37328d6465b722b2ff3f4d1e93ed56e87813ee/lxml-4.2.5-cp37-cp37m-win_amd64.whl (3.6MB)
    100% |████████████████████████████████| 3.6MB 1.6MB/s
Installing collected packages: lxml
Successfully installed lxml-4.2.5

C:UsersAdministrator>python
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from io import BytesIO
>>> some_file_or_file_like_object = BytesIO(b"<root>data</root>")
>>> from lxml import etree
>>> tree = etree.parse(some_file_or_file_like_object)
>>> etree.tostring(tree)
b'<root>data</root>'
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)



Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *