Dealing with multiple Python versions and PIP?

后端 未结 23 3555
走了就别回头了
走了就别回头了 2020-11-21 06:58

Is there any way to make pip play well with multiple versions of Python? For example, I want to use pip to explicitly install things to either my s

23条回答
  •  南旧
    南旧 (楼主)
    2020-11-21 07:35

    I ran into this issue myself recently and found that I wasn't getting the right pip for Python 3, on my Linux system that also has Python 2.

    First you must ensure that you have installed pip for your python version:

    For Python 2:

    sudo apt-get install python-pip
    

    For Python 3:

    sudo apt-get install python3-pip
    

    Then to install packages for one version of Python or the other, simply use the following for Python 2:

    pip install 
    

    or for Python 3:

    pip3 install 
    

提交回复
热议问题