简体   繁体   English

为特定版本的python安装/使用pip

[英]Install/use pip for specific version/location of python

For whatever lame reason, I have a bunch of different versions of python installed. 无论出于什么原因,我都安装了许多不同版本的python。 The one I want to use (and what my current $PATH is using) is at /opt/python2.6/bin/python. 我想使用的那个(以及我当前使用的$ PATH使用的是)在/opt/python2.6/bin/python中。 How do I install 'pip' for this version so when I do a 'pip install package' it goes to the right location? 如何为该版本安装“ pip”,所以当我执行“ pip安装软件包”时,它会转到正确的位置?

When you have multiple versions of Python with pip installed, you can launch pip using your Python executable: 如果您安装了多个带有pip的Python版本,则可以使用Python可执行文件启动pip:

$python2.6 -m pip [pip-args]

To install pip for a specific Python version, run get-pip.py ( https://bootstrap.pypa.io/get-pip.py ) with the respective Python executable: 要为特定的Python版本安装pip, 使用相应的Python可执行文件运行get-pip.pyhttps://bootstrap.pypa.io/get-pip.py ):

$python2.6 get-pip.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM