Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install libxml2 in virtualenv?

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?

like image 444
Tomasz Wysocki Avatar asked Oct 04 '10 15:10

Tomasz Wysocki


People also ask

Where do I put libxml2?

You can use an existing directory which is already in the path, such as C:\WINDOWS . You can also create a new directory for libxml and place the files there, but be sure to modify the PATH environment variable and add that new directory to its list.

How do I install LXML code in Visual Studio?

To install lxml in Visual Studio Code:Press CTRL + ` (Backtick) on your keyboard to open the terminal. Run the pip install lxml command to install the lxml module.


2 Answers

pip install ftp://xmlsoft.org/libxml2/python/libxml2-python-2.6.9.tar.gz

like image 90
turingmachine Avatar answered Oct 05 '22 01:10

turingmachine


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
like image 20
zenWeasel Avatar answered Oct 05 '22 02:10

zenWeasel