为了使软件包保持最新状态,是否有 pip freeze 的替代方案?

发布于 2025-01-16 09:28:10 字数 298 浏览 3 评论 0原文

因此,我正在通过我的 Ipad 使用 Gitpod 设置一个 Github 存储库。我了解到我可以使用此命令来轻松加载 .gitpod.yml 文件的每个需求。

pip freeze > requirements.txt

我的问题是:在需求文件中,软件包列出了它们的当前版本,但我希望它们全部采用以下形式:

pandas==*

而不是:

pandas==1.4.1

提前感谢您的帮助!

So I am setting up a Github repository with Gitpod through my Ipad. I learned I could use this command in order to easily load every requirement with the .gitpod.yml file.

pip freeze > requirements.txt

My question is: inside the requirements file, the packages are listed with their current version, but I would love them all to be of the form:

pandas==*

and not:

pandas==1.4.1

Thanks in advance for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

仅此而已 2025-01-23 09:28:10

你可以这样做:

pip freeze | sed 's|==.*|==*|g' > requirements.txt

You can do:

pip freeze | sed 's|==.*|==*|g' > requirements.txt
我乃一代侩神 2025-01-23 09:28:10

在需求文件中,列出了软件包及其当前版本

...使软件包保持最新?

然后将条目设置为 pandas,不带任何版本号:

pandas

每当您执行 pip install --upgrade -rrequirements.txt 时,它都会升级到最新版本。

请注意,您不应在生产环境中执行此操作,因为未来版本可能与您当前的代码或其他库不兼容。

inside the requirements file, the packages are listed with their current version

...keep packages up to date?

Then put the entry as just pandas without any version number:

pandas

It will upgrade to the latest version whenever you do pip install --upgrade -r requirements.txt.

Note that you shouldn't do this in a production environment because it's possible for a future version to become incompatible with your current code or other libraries.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文