views:

27

answers:

2

I have virtualenv with --no-site-packages option. I'm using scrapy in it. Scrapy uses libxml2 by import libxml2. How to install libxml2 in virtualenv using pip or easy_install?

+1  A: 

libxml2 is a C library not a python package so you cannot use Pip to install it. Normally it is already installed on almost every Linux distro out there. If you need to install it it's just

sudo apt-get install libxml2

If for some reason you absolutely need to have a local install you will need to grab and install the .deb package or the RPM. Barring that you can download the source and build it.

If you are fine with using the common copy but don't want to have /usr/local/ in your path, then just symlink it within your virtualenv.

You can find more info (than you probably wanted) at http://xmlsoft.org/

Scrapy lists it in their requirements:

  • Python 2.5 or Above
  • Twisted 2.5.0 or above
  • libxml2 2.6.28 or above (including Python bidings)
  • pyopenssl - only if you want to crawl secure (HTTPS) pages
zenWeasel

related questions