为什么 virtualenv 环境包含 argparse、distribute 和 wsgiref? [英] Why does a virtualenv environment contain argparse, distribute and wsgiref?
问题描述
我使用 virtualenv
1.7.1.2 版和 python
2.7.3 来创建虚拟 python 环境.但是当我创建这样的环境并激活它时,我可以看到安装了以下包(使用pip freeze
):
I am using virtualenv
version 1.7.1.2 with python
2.7.3 to create virtual python ennvironments. But when I create such an environment and activate it, I can see the following packages are installed (using pip freeze
):
argparse==1.2.1
distribute==0.6.24
wsgiref==0.1.2
这是为什么?这是什么意思?
Why is that? What does that mean?
推荐答案
这些是标准包,并且将始终遵循该版本的 Python 和 Virtualenv.
These are the standard packages, and will always follow with that version of Python and Virtualenv.
distribute
是不言自明的.pip
是必需的.Distribute 还包含 setuptools,但在包内,因此无法被pip freeze
识别.有关实际的更多信息,请查看您的env/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg
.
distribute
is pretty self-explainatory. It's necessary forpip
. Distribute also contains setuptools, but inside the package so not recognized withpip freeze
. For more information about what it actually does check out yourenv/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg
.
wsgiref
实际上是标准库的一部分,但不被认可.上面有一个错误报告,它在 Python 3.3+ 中得到了修复.在 为什么 pip freeze 在使用 --no-site-packages 创建的新 virtualenv 中报告一些包?
wsgiref
is actually a part of the standard library, but isn't recognized as so. There's a bug report on it, and it's fixed in Python 3.3+. Read more about it in Why does pip freeze report some packages in a fresh virtualenv created with --no-site-packages?
我不知道为什么 argparse
在那里,但我的猜测是因为它是一个依赖项或类似 wsgiref
的东西.在 Python 中查找包依赖项 可能有点麻烦/痛苦,尤其是如果它已经安装在您的 virtualenv 中.
I can't find out why argparse
is there though, but my guess is because it's a dependency or something like wsgiref
. Finding package dependencies in Python can be a bit hacky/painful though, especially if it's already installed in your virtualenv.
这篇关于为什么 virtualenv 环境包含 argparse、distribute 和 wsgiref?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!