什么是"pkg-resources == 0.0.0"?在pip Frozen命令的输出中 [英] What is "pkg-resources==0.0.0" in output of pip freeze command

查看:224
本文介绍了什么是"pkg-resources == 0.0.0"?在pip Frozen命令的输出中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行pip freeze时,我看到了(其他预期的软件包)pkg-resources==0.0.0.我看过一些帖子提到此软件包(包括 this一个),但没有解释它是什么或为什么它被包含在pip freeze的输出中.我想知道的主要原因是出于好奇,但是在某些情况下,当尝试使用包含pkg-resources==0.0.0行的pip freeze生成的requirements.txt文件安装软件包时,这似乎会破坏事情(例如,当 Travis CI 尝试通过pip安装依赖项并找到此行).

When I run pip freeze I see (among other expected packages) pkg-resources==0.0.0. I have seen a few posts mentioning this package (including this one), but none explaining what it is, or why it is included in the output of pip freeze. The main reason I am wondering is out of curiosity, but also, it seems to break things in some cases when trying to install packages with a requirements.txt file generated with pip freeze that includes the pkg-resources==0.0.0 line (for example when Travis CI tries to install dependencies through pip and finds this line).

什么是pkg-resources,可以从requirements.txt删除此行吗?

What is pkg-resources, and is it OK to remove this line from requirements.txt?

我发现当我在virtualenv中时,此行似乎仅出现在pip freeze的输出中.我仍然不确定它是什么或它做什么,但是我将进一步调查它是否可能与virtualenv有关.

I have found that this line only seems to exist in the output of pip freeze when I am in a virtualenv. I am still not sure what it is or what it does, but I will investigate further knowing that it is likely related to virtualenv.

推荐答案

根据 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

要备份上一个答案,应安全地从您的requirements.txt中删除该行.这是一个示例Make文件节,可以安全地冻结您的软件包列表(放入Makefile并使用make freeze运行):

To backup the previous answer, it should be safe to remove that line from your requirements.txt. Here is an example Make file stanza that safely freezes your package list (drop in your Makefile and run with make freeze):

freeze:
    pip freeze | grep -v "pkg-resources" > requirements.txt

这篇关于什么是"pkg-resources == 0.0.0"?在pip Frozen命令的输出中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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