如何冻结当地无法满足的要求? [英] How to freeze requirements that can't be satisfied locally?

查看:122
本文介绍了如何冻结当地无法满足的要求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个Python应用程序来部署在Heroku上。根据 Heroku的指南,我需要在Pip 要求中列出软件包要求。 txt 文件。该指南指示我在本地安装软件包,然后运行 pip freeze> requirements.txt 来编写冻结的需求文件。



然而,我想用在其中的一个包部署在Heroku上不能在本地安装。它与我的操作系统不兼容。

那么如何编写 requirements.txt 包括适合Heroku的这个包?

我能想到的唯一方法就是手工编写它 - 但这会很乏味,因为所讨论的包有很多依赖于它自己的即可。此外,这也破坏了包管理器的功能。






在将Ruby应用程序部署到Heroku时,Bundler使这一切变得简单。在我的Gemfile中,我写了

  gempg,:group => :制作
gemsqlite3,:group => :development

命令 bundle install 然后写入冻结版本列表 Gemfile.lock (类似于 requirements.txt )。它不会安装组下列出的软件包,但它仍冻结了一个一致的版本化软件包列表。



示例: Gemfile Gemfile.lock

解决方案

<这是不可能的。将问题报告给点子 https://github.com/pypa/pip/issues/747

I'm writing a Python app to deploy on Heroku. Per Heroku's guide, I need to list package requirements in a Pip requirements.txt file. The guide instructs me to install the packages locally, then run pip freeze > requirements.txt to write the frozen requirements file.

However, one of the packages I want to use in deployment on Heroku can't be installed locally. It's incompatible with my operating system.

So how do I write a requirements.txt including this package suitable for Heroku?

The only way I can think of is to write it by hand - but this would be tedious, because the package in question has many dependencies of its own. Besides, this defeats the point of the package manager.


When deploying Ruby apps to Heroku, Bundler makes this easy. In my Gemfile I write

gem "pg", :group => :production
gem "sqlite3", :group => :development

The command bundle install then writes a frozen version list Gemfile.lock (analogous to requirements.txt). It doesn't install the packages listed under the 'production' group, but it still freezes a consistent list of versioned packages.

Example: Gemfile and Gemfile.lock

解决方案

It's not possible. Issue reported to pip https://github.com/pypa/pip/issues/747

这篇关于如何冻结当地无法满足的要求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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