Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 有条件地让pip根据平台选择不同的版本_Python_Pip_Virtualenv - Fatal编程技术网

Python 有条件地让pip根据平台选择不同的版本

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版本(在

我在我的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版本(在mac上使用):

  • 非mac版本:

    -r base_requirements.txt
    matplotlib==1.3.1
    
    • 查看我的答案和此脚本: 使用@falsetru提出的相同方法,您可以使用单个shell脚本,并根据某些条件(如操作系统、arch或您想要的任何其他内容)选择各种需求文件

      -r base_requirements.txt
      matplotlib==1.3.1