Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you install lxml on OS X Leopard without using MacPorts or Fink?

I've tried this and run in to problems a bunch of times in the past. Does anyone have a recipe for installing lxml on OS X without MacPorts or Fink that definitely works?

Preferably with complete 1-2-3 steps for downloading and building each of the dependencies.

like image 441
Simon Willison Avatar asked Aug 14 '09 10:08

Simon Willison


People also ask

How do I download lxml?

In case you want to use the current in-development version of lxml, you can get it from the github repository at https://github.com/lxml/lxml . Note that this requires Cython to build the sources, see the build instructions on the project home page.

How do you make a lxml source?

To build lxml from source, you need libxml2 and libxslt properly installed, including the header files. These are likely shipped in separate -dev or -devel packages like libxml2-dev, which you must install before trying to build lxml.

Are lxml libxml2 and libxslt installed?

Unless you are using a static binary distribution (e.g. from a Windows binary installer), lxml requires libxml2 and libxslt to be installed, in particular: libxml2 version 2.9. 2 or later.

How do I install lxml on Pydroid 3?

the following way worked for me: tap the main menu button (3 horizontal stripes in top left corner) tap on "Pip" in the dropdown menu tap on the "INSTALL"-tab enter "lxml" in the input line tap on the "INSTALL" button then the installation should run when ready, and there was no error message, go to "Interpreter" in ...


2 Answers

Thanks to @jessenoller on Twitter I have an answer that fits my needs - you can compile lxml with static dependencies, hence avoiding messing with the libxml2 that ships with OS X. Here's what worked for me:

cd /tmp curl -O http://lxml.de/files/lxml-3.6.0.tgz tar -xzvf lxml-3.6.0.tgz  cd lxml-3.6.0 python setup.py build --static-deps --libxml2-version=2.7.3  --libxslt-version=1.1.24  sudo python setup.py install 
like image 156
Simon Willison Avatar answered Sep 18 '22 20:09

Simon Willison


This worked for me (10.6.8):

sudo env ARCHFLAGS="-arch i386 -arch x86_64" easy_install lxml 
like image 22
Andrei Avatar answered Sep 20 '22 20:09

Andrei