pip freeze 创建了一些奇怪的路径而不是包版本 [英] pip freeze creates some weird path instead of the package version

查看:128
本文介绍了pip freeze 创建了一些奇怪的路径而不是包版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 python 包.我使用 pip freeze >requirements.txt 将需要的包添加到requirement.txt文件中.然而,我意识到有些包,而不是包版本,在它们前面有一些路径.

numpy==1.19.0包装==20.4熊猫@ file:///opt/concourse/worker/volumes/live/38d1301c-8fa9-4d2f-662e-34dddf33b183/volume/pandas_1592841668171/workpandocfilters==1.4.2

而在环境内部,我得到:

<预><代码>>>>熊猫.__版本__'1.0.5'

你知道如何解决这个问题吗?

解决方案

看起来这是 20.1 版本中 pip freeze 的一个未解决的问题,当前的解决方法是使用:

pip list --format=freeze >要求.txt

简而言之,这是由于将 pip freeze 的行为更改为包含 直接引用,用于从直接 URL 引用安装的分发版.

您可以在 GitHub 上阅读有关该问题的更多信息:

pip freeze 不显示就地安装的版本

pip freeze"的输出;和pip list --format=freeze"通过直接 URL 安装的软件包有所不同

更好地冻结从直接 URL 引用安装的发行版

I am working on developing a python package. I use pip freeze > requirements.txt to add the required package into the requirement.txt file. However, I realized that some of the packages, instead of the package version, have some path in front of them.

numpy==1.19.0
packaging==20.4
pandas @ file:///opt/concourse/worker/volumes/live/38d1301c-8fa9-4d2f-662e-34dddf33b183/volume/pandas_1592841668171/work
pandocfilters==1.4.2

Whereas, inside the environment, I get:

>>> pandas.__version__
'1.0.5'

Do you have any idea how to address this problem?

解决方案

It looks like this is an open issue with pip freeze in version 20.1, the current workaround is to use:

pip list --format=freeze > requirements.txt

In a nutshell, this is caused by changing the behavior of pip freeze to include direct references for distributions installed from direct URL references.

You can read more about the issue on GitHub:

pip freeze does not show version for in-place installs

Output of "pip freeze" and "pip list --format=freeze" differ for packages installed via Direct URLs

Better freeze of distributions installed from direct URL references

这篇关于pip freeze 创建了一些奇怪的路径而不是包版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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