3

I have a number of python services that each use virtualenvs. I sometimes rebuild these environments, and would like to save time doing it. mkvirtualenv --system-site-packages seems close to what I want, but it still has behavior I don't understand.

One package I use is gevent (beta version), which I install directly from GitHub: sudo pip install -e git://github.com/surfly/gevent.git@1.0b4#egg=gevent. This is done outside of a virtualenv, so it goes into the system's site-packages. This works fine, and if I create a new virtualenv with --system-site-packages, it seems to be present, but with a different rev and egg specified:

[msherry@hostname:~]$ mkvirtualenv test --system-site-packages
New python executable in test/bin/python2.7
Also creating executable in test/bin/python
Installing setuptools............done.
Installing pip...............done.
[msherry@hostname:~]$ workon test
[msherry@hostname:~]$ pip freeze|grep gevent
-e git://github.com/surfly/gevent.git@15418fc8ff4460069cf42b4b0341969c54455ddd#egg=gevent-dev

It at least looks installed, though. However, when I run pip install -e git://github.com/surfly/gevent.git@1.0b4#egg=gevent, the (slow) install process for gevent begins again -- it looks like I gain nothing by using --system-site-packages.

Ideally, I'd like pip to notice that the version of gevent I'm requesting is already present, and not try to install it again. Is there any way to do what I'm attempting?

4

1 回答 1

0

在系统范围内安装时,请尝试稍微不同的语法。

sudo pip install git+git://github.com/surfly/gevent.git@1.0b4#egg=gevent

这与您的几乎相同,除了没有-eand 包含<vcs>您的网址的前缀。没有这个,pip 说

AssertionError: Sorry, 'git://github.com/surfly/gevent.git' is a malformed VCS url. The format is <vcs>+<protocol>://<url>, e.g. svn+http://myrepo/svn/MyApp#egg=MyApp

我还注意到你在“可编辑”模式下通过 pip 安装包时所做的同样的事情:我得到了提交哈希版本,就像你对你的输出所做的那样pip freeze | grep gevent

-e git://github.com/surfly/gevent.git@15418fc8ff4460069cf42b4b0341969c54455ddd#egg=gevent-dev

这对应于gevent 的那个版本

于 2013-08-29T19:51:30.410 回答