简体   繁体   中英

Installing lxml in virtualenv for windows

I've recently started using virtualenv, and would like to install lxml in this isolated environment.

Normally I would use the windows binary installer, but I want to use lxml in this virtualenv (not globally). Pip install does not work for lxml, so I'm at a loss for what I can do.

I've read that creating symlinks may work, although I unfamiliar with how symlinks work and what files I should be creating them for. Does anyone else know of any methods to install lxml in a virtualenv on Windows?

If creating symlinks is the only method that works I'm definitely willing to learn if someone can point me in the right direction.

  1. Download lxml: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
  2. Activate virtualenv
  3. easy_install /path/to/the/file/lxml-3.2.1.win32-py3.3.‌exe

The easiest way is to simply copy the library into your virtualenv site-packages folder. Symlinking is method of making it appear on the filesystem that the file is there but physically in another location. It would be truly isolated if you copied the library over.

So go into your global site-packages folder and copy over both the lxml folder and lxml egg folder into your virtualenv site-packages. If you really wanted to symlink (for NTFS), look here .

Just wanted to add that emeraldo.cs's answer is correct, but you also have to copy the lxml related files that exist in the site-packages root. Once all the files are copied, pip will think it's installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM