pip uses Python3 instead of Python2.7

If you are facing issue where pip chooses python3 over python2.7, then you need to use the correct alternative. Follow the following steps:

  1. First install pip for python2 and python3
    sudo zypper install python-pip python3-pip
  2. Choose the correct version
    sudo update-alternatives --config pip

    The following will be displayed

    There are 2 choices for the alternative pip (providing /usr/bin/pip).
    Selection Path Priority Status
    ------------------------------------------------------------
    * 0 /usr/bin/pip3.4 30 auto mode
     1 /usr/bin/pip2.7 20 manual mode
     2 /usr/bin/pip3.4 30 manual mode
    Press enter to keep the current choice[*], or type selection number:
  3. Type 1 (option infront of pip2.7) and press Enter

Leave a Reply