PIP冻结可以显示可选依赖项(方括号)吗?
我注意到,如果我安装了具有可选依赖项的软件包(setup.py extras_require):
$ pip install mypackage[optional]==1.0.0
我看不到pip freeze freeze freeze
的输出中的可选依赖性:
$ pip freeze | grep mypackage
mypackage==1.0.0
但是,我正在使用一项要求 -冻结工作流程涉及使用pip Freeze
以我在生产中使用的精确版本更新需求文件。那么,我想看到的是:
mypackage[optional]==1.0.0
有没有办法实现这一目标?
更新: 有人向我指出,我实际上在冻结工作流程中不需要这一点。在该工作流程(至少我正在使用的版本)中,您首先运行pip install -r需求to-freeze.txt
,它具有mypackage [option]
。这将找到最新版本,并安装可选依赖项。稍后,当运行pip冻结
时,可选依赖项将在列表中。因此,实际上,mypackage
出现在pip Freeze
的情况下,没有方括号表示法是可以的。预期的结果仍然可以实现。
I notice that if I install a package with optional dependencies (setup.py extras_require):
$ pip install mypackage[optional]==1.0.0
I do not see the optional dependency in the output of pip freeze
:
$ pip freeze | grep mypackage
mypackage==1.0.0
However, I'm using a requirements-to-freeze workflow that involves using pip freeze
to update the requirements file with exact versions I use in production. So, what I would like to see is:
mypackage[optional]==1.0.0
Is there a way to achieve this?
Update:
Someone pointed out to me that I actually don't need this in the requirements-to-freeze workflow. In that workflow (at least the version I'm using), you first run pip install -r requirements-to-freeze.txt
, which has mypackage[option]
. This will find the latest version and also install the optional dependencies. Later, when pip freeze
is run, the optional dependencies will be in the list. So actually, the fact that mypackage
shows up in pip freeze
without the square bracket notation is fine. The desired outcome will still be achieved.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据pip冻结文档事物
According to the pip freeze documentation, there is no option to do such that thing