English 中文(简体)
Install libxml2 and associated python bindings - Windows
原标题:

I am attempting to install libxml2 so that I can setup the python bindings and eventually use lxml.

However I am unable to work out here on earth I am supposed to be unzipping the files. I haven t been able to google successfully.

Do I need Cygwin/MinGW for the installation to be successful?

At the moment I have the files from the libxml2.tar.gz and libxslt.tar.gz in their respective directories within my Python folder. So files that were in the tars under include are in Python26includelibxml2libxml... and so on.

however when i run a easy_install lxml i receive the following output:

Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 2.2.4
Downloading http://codespeak.net/lxml/lxml-2.2.4.tgz
Processing lxml-2.2.4.tgz
Running lxml-2.2.4setup.py -q bdist_egg --dist-dir c:users
occoappdatalocal
	empeasy_install-1xwbhylxml-2.2.4egg-dist-tmp-9zwhe4
Building lxml version 2.2.4.
NOTE: Trying to build without Cython, pre-generated  src/lxml/lxml.etree.c  need
s to be available.
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  srclxml 
warning: no files found matching  lxml.objectify.c  under directory  srclxml 
warning: no files found matching  lxml.etree.h  under directory  srclxml 
warning: no files found matching  lxml.etree_api.h  under directory  srclxml 
warning: no files found matching  etree_defs.h  under directory  srclxml 
warning: no files found matching  pubkey.asc  under directory  doc 
warning: no files found matching  tagpython*.png  under directory  doc 
error: Setup script exited with error: Unable to find vcvarsall.bat

Any help whatsoever would be very helpful as I ve been trying to get this going for over a week now :(

Thanks

最佳回答

If you don t have special reasons to compile from source, you can use prebuilt binaries for lxml

问题回答

The Windows binaries of the latest version of lxml (as well as a wide range of other Python packages) are available on http://www.lfd.uci.edu/~gohlke/pythonlibs/

If you are using python 2.5.x, just use "easy_install lxml==2.2.2" to install

Realize this is an old topic but have had issues installing this on windows.

I have Python version 3.4.4.

When attempting to install whl files make sure you are using the correct version for your version of python.

so in this case i needed to use

lxml‑3.4.4‑cp34‑none‑win_amd64.whl

and not the latest which was

lxml‑3.4.4‑cp35‑none‑win_amd64.whl

cp34 indicates the python version its built for.

Trap for new players...!

It appears that the program "xslt-config" is not located in a directory in your PATH environment. Here s an article on setting PATH on Windows:

http://www.cs.usask.ca/~wew036/latex/env.html





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签