如何让“pip freeze”使用我的 Flask 模块分支?

How do I get `pip freeze` to use my fork of a Flask module?

显然有一个长期存在的bug in Flask-Bootstrap that where quick_form omits the label for radio button fields. I found a fix。首先,我将修复应用到 Flask-Bootstrap 的本地 pip 安装。发现可行,我分叉了存储库,应用到我的叉子上,执行 pip 卸载 Flask-Bootstrap 并安装我的叉子。

但是 pip freeze 列出了 Flask-Bootstrap 并且与我的分叉无关。

我需要 requirements.txt 来使用我的叉子而不是原始版本。我怎样才能做到这一点?我知道我可以 add a line in requirements.txt 来指示从存储库安装。但我宁愿避免在每次安装新的 Flask 模块时手动执行此操作。

有没有办法自动执行在 requirements.txt 中包含正确行的过程?

执行这些步骤解决了问题。首先用pip uninstall flask-bootstrap卸载Flask-Bootstrap。然后手动编辑 requirements.txt 以包含此行:

-e git+https://github.com/chivalry/flask-bootstrap.git

最后,运行 pip install -r requirements.txtpip freeze > requirements.txt。最后一个命令将编辑 requirements.txt 以包括提交 ID 和 #egg 使用的精确版本的名称。

-e git+https://github.com/chivalry/flask-bootstrap.git@c28095521664dea05f2adbf5e01fe1a36392ab6e#egg=Flask_Bootstrap