wheel python3 namespace mac example python windows python-3.x pip lxml

python3 - pip install lxml python



Cómo instalar lxml en Windows (6)

O también puede ir a la página de Christoph''s Gohlke''s Python y luego descargar el archivo lxml correcto. (Generalmente, ya que uso Python 3.4 y tengo una ventana, descargo el 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 a la izquierda y haga clic con el botón derecho al mismo tiempo y haga clic en la ventana de comandos abierta. Luego escriba C: / Python34 / Scripts / pip instale "NOMBRE DEL ARCHIVO QUE SOLO HA DESCARGADO.whl"

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

Ahora pulsa enter. Esto funcionó bien para mí, y después de escribir la cita, también puede presionar tabulador y debe llenar la correcta para usted.

Estoy tratando de instalar lmxl en mi computadora portátil con Windows 8.1 con Python 3.4 y estoy fallando miserablemente.

En primer lugar, probé la solución simple y obvia: pip install lxml . Sin embargo, esto no funcionó. Esto es lo que decía:

Downloading/unpacking lxml Running setup.py (path:C:/Users/CARTE_~1/AppData/Local/Temp/pip_build_carte_000/lxml/setup.py) egg_info for package lxml Building lxml version 3.4.2. Building without Cython. ERROR: b"''xslt-config'' is not recognized as an internal or external command,/r/noperable program or batch file./r/n" ** make sure the development packages of libxml2 and libxslt are installed ** Using build configuration of libxslt C:/Python34/lib/distutils/dist.py:260: UserWarning: Unknown distribution option: ''bugtrack_url'' warnings.warn(msg) warning: no previously-included files found matching ''*.py'' Installing collected packages: lxml Running setup.py install for lxml Building lxml version 3.4.2. Building without Cython. ERROR: b"''xslt-config'' is not recognized as an internal or external command,/r/noperable program or batch file./r/n" ** make sure the development packages of libxml2 and libxslt are installed ** Using build configuration of libxslt building ''lxml.etree'' extension C:/Python34/lib/distutils/dist.py:260: UserWarning: Unknown distribution option: ''bugtrack_url'' warnings.warn(msg) error: Unable to find vcvarsall.bat Complete output from command C:/Python34/python.exe -c "import setuptools, tokenize;__file__=''C://Users//CARTE_~1//AppData//Local//Temp//pip_build_carte_000//lxml//setup.py'';exec(compile(getattr(tokenize, ''open'', open)(__file__).read().replace(''/r/n'', ''/n''), __file__, ''exec''))" install --record C:/Users/CARTE_~1/AppData/Local/Temp/pip-l8vvrv9g-record/install-record.txt --single-version-externally-managed --compile: Building lxml version 3.4.2. Building without Cython. ERROR: b"''xslt-config'' is not recognized as an internal or external command,/r/noperable program or batch file./r/n" ** make sure the development packages of libxml2 and libxslt are installed ** Using build configuration of libxslt running install running build running build_py creating build creating build/lib.win32-3.4 creating build/lib.win32-3.4/lxml copying src/lxml/builder.py -> build/lib.win32-3.4/lxml copying src/lxml/cssselect.py -> build/lib.win32-3.4/lxml copying src/lxml/doctestcompare.py -> build/lib.win32-3.4/lxml copying src/lxml/ElementInclude.py -> build/lib.win32-3.4/lxml copying src/lxml/pyclasslookup.py -> build/lib.win32-3.4/lxml copying src/lxml/sax.py -> build/lib.win32-3.4/lxml copying src/lxml/usedoctest.py -> build/lib.win32-3.4/lxml copying src/lxml/_elementpath.py -> build/lib.win32-3.4/lxml copying src/lxml/__init__.py -> build/lib.win32-3.4/lxml creating build/lib.win32-3.4/lxml/includes copying src/lxml/includes/__init__.py -> build/lib.win32-3.4/lxml/includes creating build/lib.win32-3.4/lxml/html copying src/lxml/html/builder.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/clean.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/defs.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/diff.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/ElementSoup.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/formfill.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/html5parser.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/soupparser.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/usedoctest.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/_diffcommand.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/_html5builder.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/_setmixin.py -> build/lib.win32-3.4/lxml/html copying src/lxml/html/__init__.py -> build/lib.win32-3.4/lxml/html creating build/lib.win32-3.4/lxml/isoschematron copying src/lxml/isoschematron/__init__.py -> build/lib.win32-3.4/lxml/isoschematron copying src/lxml/lxml.etree.h -> build/lib.win32-3.4/lxml copying src/lxml/lxml.etree_api.h -> build/lib.win32-3.4/lxml copying src/lxml/includes/c14n.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/config.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/dtdvalid.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/etreepublic.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/htmlparser.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/relaxng.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/schematron.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/tree.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/uri.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/xinclude.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/xmlerror.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/xmlparser.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/xmlschema.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/xpath.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/xslt.pxd -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/etree_defs.h -> build/lib.win32-3.4/lxml/includes copying src/lxml/includes/lxml-version.h -> build/lib.win32-3.4/lxml/includes creating build/lib.win32-3.4/lxml/isoschematron/resources creating build/lib.win32-3.4/lxml/isoschematron/resources/rng copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.win32-3.4/lxml/isoschematron/resources/rng creating build/lib.win32-3.4/lxml/isoschematron/resources/xsl copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.win32-3.4/lxml/isoschematron/resources/xsl copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.win32-3.4/lxml/isoschematron/resources/xsl creating build/lib.win32-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1 copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.win32-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1 copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.win32-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1 copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.win32-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1 copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.win32-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1 copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.win32-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1 copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.win32-3.4/lxml/isoschematron/resources/xsl/iso-schematron-xslt1 running build_ext building ''lxml.etree'' extension C:/Python34/lib/distutils/dist.py:260: UserWarning: Unknown distribution option: ''bugtrack_url'' warnings.warn(msg) error: Unable to find vcvarsall.bat ---------------------------------------- Cleaning up... Command C:/Python34/python.exe -c "import setuptools, tokenize;__file__=''C://Users//CARTE_~1//AppData//Local//Temp//pip_build_carte_000//lxml//setup.py'';exec(compile(getattr(tokenize, ''open'', open)(__file__).read().replace(''/r/n'', ''/n''), __file__, ''exec''))" install --record C:/Users/CARTE_~1/AppData/Local/Temp/pip-l8vvrv9g-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in C:/Users/CARTE_~1/AppData/Local/Temp/pip_build_carte_000/lxml Storing debug log for failure in C:/Users/carte_000/pip/pip.log

Entonces busqué en esta gran cosa útil llamada Internet y muchas personas tienen el mismo error de necesitar libxml2 y libxlst . Recomiendan a un tipo llamado Christoph Gohlke en la página donde proporciona algún tipo de cosa binaria para un montón de paquetes. Puedes encontrarlo here ( enlace rápido a la parte lxml ).

Entonces, después de que dejé de intentar encontrar libxml2 y libxslt para pip, decidí ir allí y encontré una tonelada absoluta de descargas. Sé que necesito uno de 64 bits, pero no tengo idea de qué " cp " necesito.

Entonces, una respuesta que me dé una solución sobre el método pip o el método de índice de Gohlke sería genial.


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

C:/Users/Administrator>"c:/Program Files/Python37/python.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 Files/Python37/Scripts'' 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:/Users/Administrator>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:/Users/Administrator>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>''


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

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


También me encuentro con este problema recientemente. pip no puede no funcionar en el archivo .whl En lugar de arreglar esto, lo instalo a través del archivo .exe. puede descargarlo desde here favor, elija la versión correcta de su python. Espero que esto le pueda ayudar.


Tuve este problema con un archivo de requisitos que enumeraba lxml == 4.2.1. Sin embargo, pude solucionar el problema actualizándolo a lxml == 4.2.5.


Estas instrucciones son para Windows7 o Windows8 con Python3.4 .

Sin embargo , deberían funcionar para varias versiones, ya que las versiones de python y otros requisitos previos respectivos cambian / evolucionan:

  1. Instala Python3.4 :
    1. Descargue la última versión de Python3.4 desde la página de descargas HERE
      • Enlace directo para el instalador de Win32 MSI -> HERE
    2. Simplemente ejecuta el MSI para instalar Python. Se registrará en el registro y aparecerá en Agregar / Reemplazar programas.
    3. NOTA: mis instrucciones a continuación suponen que elige instalar python en la ruta predeterminada de C:/python34/ cuando se le pregunte durante el Asistente de instalación de Python
  2. Agregue las C:/python33/ y C:/python34/scripts a la ruta del sistema agregando esos directorios a la PATH entorno PATH desde el enlace Panel de control> Sistema> Configuración avanzada del sistema (pestaña Avanzada)> Variables ambientales (botón) .
  3. Instala OpenSSL :
    1. Descargue la página Win32 OpenSSL desde HERE para su versión de Windows y arquitectura de PC
    2. Descargue Visual C ++ 2008 redistribuibles para su versión de Windows y arquitectura de PC
    3. Descargue OpenSSL para su versión de Windows y arquitectura (la versión regular, no la ligera)
    4. Agregue el directorio c:/openssl-win32/bin (o similar) a su PATH , de la misma manera que agregó C:/python34 y C:/python34/scripts anteriores.
  4. Instale Setuptools ( get-pip.py debería instalar Setuptools por usted), pero, por si acaso ...
    1. Descargue ez_setup.py HERE y guárdelo en C:/python34/scripts
    2. Ejecute C:/python34/scripts> python ez_setup.py
  5. Instalar PIP
    1. Descargue get-pip.py desde HERE y guárdelo en C:/python34/scripts
    2. Ejecute C:/python34/scripts> python get-pip.py
  6. Instalar LXML
    1. Descargue LXML 3.4.4 desde HERE para su versión de Windows y arquitectura de PC
    2. Ejecuta el archivo EXE