6

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.

4

3 回答 3

8
  1. 下载lxml:http ://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
  2. 激活虚拟环境
  3. easy_install /path/to/the/file/lxml-3.2.1.win32-py3.3.‌exe
于 2013-07-13T14:37:36.023 回答
5

最简单的方法是简单地将库复制到您的 virtualenv 站点包文件夹中。符号链接是使它出现在文件系统上的方法,该文件存在但物理上位于另一个位置。如果您将库复制过来,它将真正被隔离。

因此,进入您的全局站点包文件夹并将 lxml 文件夹和 lxml egg 文件夹复制到您的 virtualenv 站点包中。如果您真的想要符号链接(对于 NTFS),请看这里

于 2012-07-02T04:35:41.837 回答
0

只是想补充一点,emeraldo.cs 的答案是正确的,但您还必须复制站点包根目录中存在的 lxml 相关文件。复制完所有文件后,pip 会认为它已安装。

于 2014-05-07T03:12:04.010 回答