Dealing with multiple Python versions and PIP?

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

    On Windows, you can execute the pip module using a given Python version through the Python launcher, py.exe, if you chose to install it during Python 3 setup.

    py -3 -m pip install packagename
    py -2 -m pip install packagename
    

    You can be even more specific and request an exact sub-version of Python:

    py -3.6 -m pip install packagename
    

    To get a list of all installed Python versions available through the launcher, run:

    py --list
    

    Alternatively, you can launch the desired Python executable directly:

    C:/path/to/specific/python.exe -m pip install packagename
    

提交回复
热议问题