Installing lxml in virtualenv for windows

天大地大妈咪最大 提交于 2019-12-21 05:05:15

问题


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:


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.




回答2:


  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



回答3:


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.



来源:https://stackoverflow.com/questions/11287585/installing-lxml-in-virtualenv-for-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!