Operating-system specific requirements with pip

In the end, adding the OS check in the setup.py is what I've found other people using. Ex:

install_requires = [
        "parsedatetime >= 1.1.2",
        "colorama >= 0.2.5",
        "pycrypto >= 2.6"
        ] + ["pyreadline >= 2.0"] if "win" in sys.platform else [],

link to full setup.py with example code


You can do this with "Environment Markers" as specified in PEP-508:

Here's an example of using such a marker inside a requirements.txt:

pyreadline==2.1; platform_system == "Windows"

Similarly, in a setup.py:

setup(
    ...
    install_requires=['pyreadline; platform_system == "Windows"'],
)