pip对操作系统的特定要求 [英] Operating-system specific requirements with pip

查看:168
本文介绍了pip对操作系统的特定要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可能在pip的requirements.txt文件中有特定于操作系统的要求?

Is it possible to have OS specific requirements in pip's requirements.txt file?

例如: 我对 readline 有依赖性,因此,如果要在Windows(或OSX)上安装,则必须 pyreadline .如果是linux,那么我不想强制安装.

For example: I have a dependency on readline, therefore, if installing on windows (or OSX), then pyreadline is a requirement. If it's linux, then I don't want to force an install.

推荐答案

最后,我发现其他人正在使用在setup.py中添加OS检查.例如:

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 [],

链接到带有示例代码的完整setup.py

这篇关于pip对操作系统的特定要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆