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
?
相关问题
- How to install local library with pip to a conda e
- scrapy get nth-child text of same class
- Cant Install Tensorflow 2.2.0rc0 in Ubuntu with Gi
- ssl not available
- Scrapy - Use feed exporter for a particular spider
相关文章
- 在liunx 安装Levenshtein错误
- scrapy框架怎么用啊
- Raspberry Pi-Python: Install Pandas on Python 3.5.
- ImportError: No module named twisted.persisted.sty
- Should I use pip.main() or subprocess.call() to in
- Scrapy - Select specific link based on text
- How can I add dependency link to repo subdirectory
- Is there a way for pip to install only new depende
I have just come to this problem, with Ubuntu 14.04 kernel.
I already installed lxml using pip.
When I try to
pip install lxml --upgrade
inside the virtualenv, it always gave me aI solved this using
sudo apt-get install libssl-dev
.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:
pip install ftp://xmlsoft.org/libxml2/python/libxml2-python-2.6.9.tar.gz
If you installed python-libxml2 using apt-get (or other package manager) you can access it from virtualenv with the
--system-site-packages
flag.When creating your virtualenv just specify this flag, e.g:
This way your virtualenv will inherit the libxml2 package which is installed system wide.
Before install lxml (on Debian):
Where
pythonX.X
ispython2.7
orpython2.6
or other needled python version.After install system packages:
Alternatively, if you are on windows, as I suspect from your question, you need to either get the libxml2 binary-- there are links on the scrapy site, and as of Nov 2010, a version has been compiled that will work with everything-- or get the current trunk/dev version of scrapy, which works with lxml2. For virtualenv, since I'm not sure how to setup with an extra binary, the latter approach might be best. I've adopted the latter approach and it works flawlessly for me so far. Thanks to Pablo Hoffman the ultra-helpful creator of Scrapy (when I posted a question much like this one on Scrapy's mailing list, he released this change to trunk almost the next day). Note: libxml2 binary that worked with python 2.7 wasn't yet available at that time.