问题
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