Search code examples
pythonwindowspyquery

Python/PyQuery: Unable to find vcvarsall.bat?


I have Python 2.7 and I was trying to use PyQuery, so for a test I just typed "import PyQuery" and I got an error:

Traceback (most recent call last):
  File "C:\Users\Jacob\Documents\dupes.py", line 1, in <module>
    import pyquery
  File "C:\Python27\lib\site-packages\pyquery-1.2.1-py2.7.egg\pyquery\__init__.py", line 12, in <module>
    from .pyquery import PyQuery
  File "C:\Python27\lib\site-packages\pyquery-1.2.1-py2.7.egg\pyquery\pyquery.py", line 8, in <module>
    from lxml import etree
ImportError: No module named lxml

So I went to the command prompt and tried to install lxml, but I got this:

Building lxml version 2.3.5.
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
error: Setup script exited with error: Unable to find vcvarsall.bat

I don't really understand what's wrong or what I should do...can someone help?

Thanks.

EDIT:

In response to the comment, I used easy install...


Solution

  • From installation instructions of lxml:

    easy_install --allow-hosts=lxml.de,*.python.org lxml
    

    On MS Windows, the above will install the binary builds that we provide. If there is no binary build of the latest release yet, please search PyPI for the last release that has them and pass that version to easy_install like this:

    easy_install --allow-hosts=lxml.de,*.python.org lxml==2.2.2
    

    [edit]

    Ok, 2.2.2 was en example. I went and looked for you, try:

    easy_install --allow-hosts=lxml.de,*.python.org lxml==2.3