Dealing with multiple Python versions and PIP?

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

    I had python 2.6 installed by default (Amazon EC2 AMI), but needed python2.7 plus some external packages for my application. Assuming you already installed python2.7 alongside with default python (2.6 in my case). Here is how to install pip and packages for non-default python2.7

    Install pip for your python version:

    curl -O https://bootstrap.pypa.io/get-pip.py
    python27 get-pip.py
    

    Use specific pip version to install packages:

    pip2.7 install mysql-connector-python --allow-external mysql-connector-python
    

提交回复
热议问题