Python 有条件地让pip根据平台选择不同的版本
我在我的requirements.txt中有这个Python 有条件地让pip根据平台选择不同的版本,python,pip,virtualenv,Python,Pip,Virtualenv,我在我的requirements.txt中有这个 matplotlib==1.3.1 这将安装在linux上,但不安装在mac上,请参阅: 如果你想说 if platform==mac: matplotlib==1.3.1 else: -e git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib 但显然不能,因为皮普不明白。我该怎么做?制作多个需求文件怎么样 不包含任何matplotlib行的基本需求文件 mac版本(在
matplotlib==1.3.1
这将安装在linux上,但不安装在mac上,请参阅:
如果你想说
if platform==mac: matplotlib==1.3.1
else: -e git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib
但显然不能,因为皮普不明白。我该怎么做?制作多个需求文件怎么样
- 不包含任何
行的基本需求文件李>matplotlib
- mac版本(在mac上使用):
- 非mac版本:
-r base_requirements.txt matplotlib==1.3.1
- 查看我的答案和此脚本:
使用@falsetru提出的相同方法,您可以使用单个shell脚本,并根据某些条件(如操作系统、arch或您想要的任何其他内容)选择各种需求文件
-r base_requirements.txt
matplotlib==1.3.1