本文介绍了点子冻结为什么会列出"pkg-resources == 0.0.0"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在具有virtualenv 15.0.1和Python 3.5.2(均与apt一起安装)的Ubuntu 16.04上,当我创建并激活新的Python虚拟环境时

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

virtualenv .virtualenvs/wtf -p $(which python3) --no-site-packages
source .virtualenvs/wtf/bin/activate

我得到以下输出:

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.

实际上,pip freeze --all列出了这4个软件包:

Indeed pip freeze --all lists these 4 packages:

pip==8.1.2
pkg-resources==0.0.0
setuptools==25.2.0
wheel==0.29.0

但是,我希望pip freeze(没有--all)忽略这些隐式安装的软件包.它确实省略了其中的一些,但没有pkg-resources:

Though, I'd expect pip freeze (without --all) to omit these implicitly installed packages. It does omit some of them, but not pkg-resources:

pkg-resources==0.0.0

(与pip freeze --local相同)

这与帮助文本一致

$> pip freeze --help | grep '\--all'
  --all                       Do not skip these packages in the output: pip, setuptools, distribute, wheel

pip freeze输出中具有pkg-resources

似乎不是很有用,甚至可能有害. (我怀疑这就是为什么从 pip-tools 运行pip-sync会从虚拟环境中卸载pkg-resources,从而巧妙地破坏环境的原因为什么pip freeze列出pkg-resources而不是忽略它有充分的理由吗?据我所知,它没有在Ubuntu 14.04上列出(使用Python 3.4)

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).

推荐答案

根据 https://github.com/pypa /pip/issues/4022 ,这是由于Ubuntu为pip提供错误的元数据而导致的错误.因此,似乎没有任何合理的理由来进行这种行为.我向Ubuntu提交了一个后续错误. https://bugs.launchpad.net/ubuntu/+source/python-pip/+ bug/1635463

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

这篇关于点子冻结为什么会列出"pkg-resources == 0.0.0"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 17:32