为什么pip冻结会报告使用--no-site-packages创建的全新virtualenv中的某些软件包? [英] Why does pip freeze report some packages in a fresh virtualenv created with --no-site-packages?

查看:71
本文介绍了为什么pip冻结会报告使用--no-site-packages创建的全新virtualenv中的某些软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我创建一个新的virtualenv时,pip freeze显示即使我没有在环境中安装任何东西,我也已经安装了几个软件包.我一直期望pip freeze返回空的输出,直到我的第一个pip install进入环境之后. wsgiref是标准库的一部分,不是吗,为什么它显示在全部?

When I create a fresh virtualenv, pip freeze shows that I have a couple of packages installed even though I've not installed anything into the environment. I was expecting pip freeze to return empty output until after my first pip install into the environment. wsgiref is part of the standard library isn't it, so why does it show up at all?


day@garage:~$ mkdir testing
day@garage:~$ cd testing
day@garage:~/testing$ virtualenv --no-site-packages .
New python executable in ./bin/python
Installing distribute..........................................................
...............................................................................
.........................................done.
day@garage:~/testing$ . bin/activate
(testing)day@garage:~/testing$ pip freeze
distribute==0.6.10
wsgiref==0.1.2

一些额外的信息:


(testing)day@garage:~/testing$ pip --version
pip 0.7.2 from /home/day/testing/lib/python2.7/site-packages/pip-0.7.2-py2.7.eg
g (python 2.7)
(testing)day@garage:~/testing$ deactivate
day@garage:~/testing$ virtualenv --version
1.4.9
day@garage:~/testing$ which virtualenv
/usr/bin/virtualenv
day@garage:~/testing$ dpkg -S /usr/bin/virtualenv
python-virtualenv: /usr/bin/virtualenv
day@garage:~/testing$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.04
DISTRIB_CODENAME=natty
DISTRIB_DESCRIPTION="Ubuntu 11.04"

推荐答案

每次使用--no-site-packages创建virtualenv时,它都会安装setuptoolsdistribute.出现wsgiref的原因是因为python 2.5+标准库向wsgiref lib提供了鸡蛋信息(而pip不知道它是stdlib还是第三方软件包).

Everytime you create a virtualenv with --no-site-packages it installs setuptools or distribute. And the reason wsgiref appears is because python 2.5+ standard library provides egg info to wsgiref lib (and pip does not know if it stdlib or 3rd party package).

似乎已在Python3.3 +上解决: http://bugs.python.org/issue12218

It seems to be solved on Python3.3+: http://bugs.python.org/issue12218

这篇关于为什么pip冻结会报告使用--no-site-packages创建的全新virtualenv中的某些软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆