distutils/pip 中的可选依赖项 [英] Optional dependencies in distutils / pip

查看:37
本文介绍了distutils/pip 中的可选依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装我的 python 包时,我希望能够告诉用户各种可选的依赖项.理想情况下,我还想打印一条关于这些可选要求及其用途的消息.

When installing my python package, I want to be able to tell the user about various optional dependencies. Ideally I would also like to print out a message about these optional requirements and what each of them do.

我还没有在 pip 或 docutils 的文档中看到任何内容.这些工具是否支持可选的依赖项?

I haven't seen anything yet in the docs of either pip or docutils. Do tools these support optional dependencies?

推荐答案

这些被称为附加项,这里是如何在 setup.py 中使用它们.

基础支持在 pkg_resources 中.您需要在 setup.py 中启用分发.pip 也会理解它们:

The base support is in pkg_resources. You need to enable distribute in your setup.py. pip will also understand them:

pip install 'package[extras]'

这篇关于distutils/pip 中的可选依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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