Optional dependencies in distutils / pip

半腔热情 提交于 2019-11-27 04:26:13

问题


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.

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


回答1:


These are called extras, here is how to use them in your setup.py.

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]'


来源:https://stackoverflow.com/questions/6237946/optional-dependencies-in-distutils-pip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!