Provide a complex condition in install_requires ( Python setuptools's setup.py )
问题 Does anybody know how I can provide a complex condition in the "install_requires" section of setup.py? Something like this: install_requires = ['project1 >= 0.0.1 or project2 >=0.0.2', 'project3==0.9.0'] 回答1: You can write something like this: def choose_proper_prject( requires ): import pkg_resources for req in requires: try: pkg_resources.require( req ) return [ req ] except pkg_resources.DistributionNotFound : pass pass print “There are no proper project installation available” print “To