为什么 pip freeze 在使用 --no-site-packages 创建的新 virtualenv 中报告一些包? [英] Why does pip freeze report some packages in a fresh virtualenv created with --no-site-packages?
问题描述
当我创建一个新的 virtualenv 时,pip freeze
显示我已经安装了几个包,即使我没有在环境中安装任何东西.我期待 pip freeze
返回空输出,直到我第一次 pip install
进入环境.wsgiref 是标准库的一部分 是不是,那么为什么它出现在全部?
一些额外的信息:
<前>(testing)day@garage:~/testing$ pip --version来自/home/day/testing/lib/python2.7/site-packages/pip-0.7.2-py2.7.eg 的 pip 0.7.2g (python 2.7)(testing)day@garage:~/testing$ 停用day@garage:~/testing$ virtualenv --version1.4.9day@garage:~/testing$ which virtualenv/usr/bin/virtualenvday@garage:~/testing$ dpkg -S/usr/bin/virtualenvpython-virtualenv:/usr/bin/virtualenvday@garage:~/testing$ cat/etc/lsb-releaseDISTRIB_ID=UbuntuDISTRIB_RELEASE=11.04DISTRIB_CODENAME=整洁DISTRIB_DESCRIPTION="Ubuntu 11.04"每次使用 --no-site-packages 创建 virtualenv 时,它都会安装 setuptools
或 distribute
.而 wsgiref
出现的原因是因为 python 2.5+ 标准库向 wsgiref
lib 提供了 egg 信息(并且 pip
不知道它是 stdlib 还是 3rd派对套餐).
似乎在 Python3.3+ 上解决了:http://bugs.python.org/issue12218一个>
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
Some extra info:
(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"
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).
It seems to be solved on Python3.3+: http://bugs.python.org/issue12218
这篇关于为什么 pip freeze 在使用 --no-site-packages 创建的新 virtualenv 中报告一些包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!