2012-02-26 37 views
25

Estoy usando python 2.7 en Windows. ¿Cómo es posible que se produzca el siguiente error cuando intento instalar [lxml] [1] utilizando [setuptools] [2] 's easy_install?easy_install lxml en Python 2.7 en Windows

C:\>easy_install lxml 
Searching for lxml 
Reading http://pypi.python.org/simple/lxml/ 
Reading http://codespeak.net/lxml 
Best match: lxml 2.3.3 
Downloading http://lxml.de/files/lxml-2.3.3.tgz 
Processing lxml-2.3.3.tgz 
Running lxml-2.3.3\setup.py -q bdist_egg --dist-dir c:\users\my_user\appdata\local\temp\easy_install-mtrdj2\lxml-2.3.3\egg-dist-tmp-tq8rx4 
Building lxml version 2.3.3. 
Building without Cython. 
ERROR: 'xslt-config' is not recognized as an internal or external command, 
operable program or batch file. 

** make sure the development packages of libxml2 and libxslt are installed ** 

Using build configuration of libxslt 
warning: no files found matching 'lxml.etree.c' under directory 'src\lxml' 
warning: no files found matching 'lxml.objectify.c' under directory 'src\lxml' 
warning: no files found matching 'lxml.etree.h' under directory 'src\lxml' 
warning: no files found matching 'lxml.etree_api.h' under directory 'src\lxml' 
warning: no files found matching 'etree_defs.h' under directory 'src\lxml' 
warning: no files found matching 'pubkey.asc' under directory 'doc' 
warning: no files found matching 'tagpython*.png' under directory 'doc' 
warning: no files found matching 'Makefile' under directory 'doc' 
error: Setup script exited with error: Unable to find vcvarsall.bat 

Obtención del paquete y funcionando setup.py install también no ayuda:

D:\My Documents\Installs\Dev\Python\lxml\lxml-2.3.3>setup.py install 
Building lxml version 2.3.3. 
Building without Cython. 
ERROR: 'xslt-config' is not recognized as an internal or external command, 
operable program or batch file. 

** make sure the development packages of libxml2 and libxslt are installed ** 

Using build configuration of libxslt 
running install 
running bdist_egg 
running egg_info 
writing src\lxml.egg-info\PKG-INFO 
writing top-level names to src\lxml.egg-info\top_level.txt 
writing dependency_links to src\lxml.egg-info\dependency_links.txt 
reading manifest file 'src\lxml.egg-info\SOURCES.txt' 
reading manifest template 'MANIFEST.in' 
warning: no files found matching 'lxml.etree.c' under directory 'src\lxml' 
warning: no files found matching 'lxml.objectify.c' under directory 'src\lxml' 
warning: no files found matching 'lxml.etree.h' under directory 'src\lxml' 
warning: no files found matching 'lxml.etree_api.h' under directory 'src\lxml' 
warning: no files found matching 'etree_defs.h' under directory 'src\lxml' 
warning: no files found matching 'pubkey.asc' under directory 'doc' 
warning: no files found matching 'tagpython*.png' under directory 'doc' 
warning: no files found matching 'Makefile' under directory 'doc' 
writing manifest file 'src\lxml.egg-info\SOURCES.txt' 
installing library code to build\bdist.win32\egg 
running install_lib 
running build_py 
creating build 
creating build\lib.win32-2.7 
creating build\lib.win32-2.7\lxml 
copying src\lxml\builder.py -> build\lib.win32-2.7\lxml 
copying src\lxml\cssselect.py -> build\lib.win32-2.7\lxml 
copying src\lxml\doctestcompare.py -> build\lib.win32-2.7\lxml 
copying src\lxml\ElementInclude.py -> build\lib.win32-2.7\lxml 
copying src\lxml\pyclasslookup.py -> build\lib.win32-2.7\lxml 
copying src\lxml\sax.py -> build\lib.win32-2.7\lxml 
copying src\lxml\usedoctest.py -> build\lib.win32-2.7\lxml 
copying src\lxml\_elementpath.py -> build\lib.win32-2.7\lxml 
copying src\lxml\__init__.py -> build\lib.win32-2.7\lxml 
creating build\lib.win32-2.7\lxml\html 
copying src\lxml\html\builder.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\clean.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\defs.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\diff.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\ElementSoup.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\formfill.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\html5parser.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\soupparser.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\usedoctest.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\_dictmixin.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\_diffcommand.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\_html5builder.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\_setmixin.py -> build\lib.win32-2.7\lxml\html 
copying src\lxml\html\__init__.py -> build\lib.win32-2.7\lxml\html 
creating build\lib.win32-2.7\lxml\isoschematron 
copying src\lxml\isoschematron\__init__.py -> build\lib.win32-2.7\lxml\isoschematron 
copying src\lxml\etreepublic.pxd -> build\lib.win32-2.7\lxml 
copying src\lxml\tree.pxd -> build\lib.win32-2.7\lxml 
copying src\lxml\etree_defs.h -> build\lib.win32-2.7\lxml 
creating build\lib.win32-2.7\lxml\isoschematron\resources 
creating build\lib.win32-2.7\lxml\isoschematron\resources\rng 
copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win32-2.7\lxml\isoschematron\resources\rng 
creating build\lib.win32-2.7\lxml\isoschematron\resources\xsl 
copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl 
copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl 
creating build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win32-2.7\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-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 
running build_ext 
building 'lxml.etree' extension 
error: Unable to find vcvarsall.bat 

    [1]: http://lxml.de/ 
    [2]: http://pypi.python.org/pypi/setuptools 
+0

intente ejecutar desde el indicador de comando de Visual Studio –

+1

Pude descargar un programa de instalación desde [aquí] (http://www.lfd.uci.edu/~gohlke/pythonlibs/) que funcionó, sin embargo, me gustaría seguir para saber por qué el método regular no funcionó ... – Jonathan

+0

¿Tiene el compilador de C? – reclosedev

Respuesta

45

lxml> = 3.xx

  1. descarga uno de los paquetes MS Windows Installer
  2. easy_install "c:/lxml_installer.exe"(credit kobejohn)

MS Windows Installer downloads available for lxml 3.3.5

un list of all binary/egg lxml package downloads.


lxml 2.3.x

no hay ventanas de huevo binario para lxml 2.3.3 (2.3.0 es la última de 2.x.x).
sin dar un número de versión easy_install descargará las últimas fuentes,
pero no tiene instaladas libxml2 y libxslt.

puede instalar las librerías faltantes o puede probar con el 2.3, ya que hay huevos binarios para Windows:
easy_install lxml==2.3

+1

[pypi.python.org lista de paquetes lxml] (https://pypi.python.org/packages/2.7/l/lxml/) –

+0

Fallé la instalación de lxml 2.3.3 en un virtualenv –

+0

Esta instalación en conda me ha estado matando durante los últimos tres días ! Esta es la solución que finalmente funcionó para mí. – RYS

25

se puede descargar no oficiales de Windows binarios en: http://www.lfd.uci.edu/~gohlke/pythonlibs/

por ejemplo, para python 2.7 32bit: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

Es la forma más fácil en win32.

+5

No funcionará directamente para virtualenv. Así que use easy_install de su virtualenv con el instalador binario descargado para que funcione. es decir 'easy_install" c: /lxml_installer.exe "' (editar. Odio tener que hacer esto con Windows, pero es la forma más fácil que he encontrado. Funcionará desde la URL también, pero no había un archivo directo enlace para los binarios en la página en esta respuesta) – KobeJohn

10

Me encontré con el mismo problema. No sé sobre el tema vcvarsall.bat pero si sólo desea instalar lxml Puede utilizar los instaladores gráficos aquí:

https://pypi.python.org/pypi/lxml/3.2.3

que trabajó para mí.

1

La solución ideal (que también funciona en entornos virtuales) se ha proporcionado here.

Básicamente, se trata de la descarga de un archivo de la rueda de ajuste de here (el "CP" en el nombre del archivo se refiere a su versión de Python) y luego simplemente pip install ing ella.

Funciona en mi (virtualenv) instalación de Python3.3 en Windows 7 de 64 bits.

+0

Sí, esto es lo único que funciona para mí. ¡Perfecto! – Pztar