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

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

问题描述

当我运行 pip freeze 时,我看到(在其他预期的包中)pkg-resources==0.0.0.我看到一些帖子提到这个包(包括 this一个),但没有解释它是什么,或者为什么它包含在 pip freeze 的输出中.我想知道的主要原因是出于好奇,而且,在某些情况下,当尝试使用 pip freezerequirements.txt 文件安装包时,似乎会破坏一些东西> 包括 pkg-resources==0.0.0 行(例如当 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/+错误/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 freeze 命令的输出中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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