Dealing with multiple Python versions and PIP?

后端 未结 23 2812
走了就别回头了
走了就别回头了 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:18

    From here: https://docs.python.org/3/installing/

    Here is how to install packages for various versions that are installed at the same time linux, mac, posix:

    python2   -m pip install SomePackage  # default Python 2
    python2.7 -m pip install SomePackage  # specifically Python 2.7
    python3   -m pip install SomePackage  # default Python 3
    python3.4 -m pip install SomePackage  # specifically Python 3.4
    python3.5 -m pip install SomePackage  # specifically Python 3.5
    python3.6 -m pip install SomePackage  # specifically Python 3.6
    

    On Windows, use the py Python launcher in combination with the -m switch:

    py -2   -m pip install SomePackage  # default Python 2
    py -2.7 -m pip install SomePackage  # specifically Python 2.7
    py -3   -m pip install SomePackage  # default Python 3
    py -3.4 -m pip install SomePackage  # specifically Python 3.4
    

提交回复
热议问题