On Ubuntu 16.04 with virtualenv 15.0.1 and Python 3.5.2 (both installed with apt
) when I create and activate new Python virtual environment with
在Ubuntu 16.04上使用virtualenv 15.0.1和Python 3.5.2(都安装了apt)当我创建和激活新的Python虚拟环境时
virtualenv .virtualenvs/wtf -p $(which python3) --no-site-packages
source .virtualenvs/wtf/bin/activate
I get the following output:
我得到以下输出:
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/das-g/.virtualenvs/wtf/bin/python3
Also creating executable in /home/das-g/.virtualenvs/wtf/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
Indeed pip freeze --all
lists these 4 packages:
确实pip冻结 - 所有列出这4个包:
pip==8.1.2
pkg-resources==0.0.0
setuptools==25.2.0
wheel==0.29.0
Though, I'd expect pip freeze
(without --all
) to omit these implicitly installed packages. It does omit some of them, but not pkg-resources
:
虽然,我希望pip冻结(没有--all)省略这些隐式安装的包。它确实省略了一些,但没有pkg资源:
pkg-resources==0.0.0
(Same btw. for pip freeze --local
)
(同样顺便说一下pip freeze --local)
While this is consistent with the help text
虽然这与帮助文本一致
$> pip freeze --help | grep '\--all'
--all Do not skip these packages in the output: pip, setuptools, distribute, wheel
having pkg-resources
in the pip freeze
output doesn't seem very useful and might even be harmful. (I suspect it's why running pip-sync
from pip-tools uninstalls pkg-resources from the virtual environment, subtly breaking the environment thereby.) Is there any good reason why pip freeze
lists pkg-resources
instead of omitting it, too? As far as I remember, it didn't list it on Ubuntu 14.04 (with Python 3.4).
在pip冻结输出中有pkg资源似乎没有用,甚至可能有害。 (我怀疑这就是为什么从pip-tools运行pip-sync会从虚拟环境中卸载pkg-resources,从而巧妙地破坏环境。)pip冻结列出pkg-resources而不是省略它有什么好的理由吗?据我所知,它没有在Ubuntu 14.04(使用Python 3.4)上列出。
2 个解决方案
#1
18
According to https://github.com/pypa/pip/issues/4022, this is a bug resulting from Ubuntu providing incorrect metadata to pip. So, no there does not seem to be a good reason for this behaviour. I filed a follow-up bug with Ubuntu. https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
根据https://github.com/pypa/pip/issues/4022,这是由Ubuntu提供错误元数据到pip的错误。所以,似乎没有这种行为的充分理由。我向Ubuntu提交了一个后续错误。 https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
#2
0
I had the same problem in my virtual environment. I removed it with pip uninstall pkg-resources==0.0.0
我在虚拟环境中遇到了同样的问题。我用pip uninstall pkg-resources == 0.0.0删除了它
#1
18
According to https://github.com/pypa/pip/issues/4022, this is a bug resulting from Ubuntu providing incorrect metadata to pip. So, no there does not seem to be a good reason for this behaviour. I filed a follow-up bug with Ubuntu. https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
根据https://github.com/pypa/pip/issues/4022,这是由Ubuntu提供错误元数据到pip的错误。所以,似乎没有这种行为的充分理由。我向Ubuntu提交了一个后续错误。 https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
#2
0
I had the same problem in my virtual environment. I removed it with pip uninstall pkg-resources==0.0.0
我在虚拟环境中遇到了同样的问题。我用pip uninstall pkg-resources == 0.0.0删除了它