Specific reasons to favor pip vs. conda when installing Python packages

前端 未结 6 2009
花落未央
花落未央 2020-12-13 20:15

I use miniconda as my default python installation. What is the current (2019) wisdom regarding when to install something with conda vs. pip?

My usual behavior is to

6条回答
  •  悲&欢浪女
    2020-12-13 20:58

    As add-on to @eatmeimadanisch and @merve's recommendation "use conda first, thenn try pip", here is the corresponding code to run this from the command line of a linux system:

    while read requirement; do conda install --yes $requirement || pip install $requirement; done < requirements.txt
    

    This assumes that all packages with desired package number are put into a file called "requirements.txt". The entries look like this for example:

    matplotlib==2.0.0
    numpy==1.18.1
    

    Note that the equal sign is double (==), not single (=).

提交回复
热议问题