我的setup.py文件大致如下:
from distutils.core import setup
setup(
[...]
install_requires=['gevent', 'ssl', 'configobj', 'simplejson', 'mechanize'],
[...]
)
在Python 2.6(或更高版本)中,安装ssl模块失败并出现以下错误:
ValueError: This extension should not be used with Python 2.6 or later (already built in), and has not been tested with Python 2.3.4 or earlier.
有没有一种标准的方法只为特定的Python版本定义依赖关系?当然,我可以使用if float(sys.version[:3]) < 2.6:
来实现,但也许有更好的方法。
install_requires
作为distutils.core.setup
的参数,它似乎是遗留下来的setuptools
。http://docs.python.org/2/distutils/apiref.html#distutils.core.setup - jrwren