How to change pip3 command to be pip?

前端 未结 9 2496
梦毁少年i
梦毁少年i 2020-12-04 23:33

I uninstalled pip, and I installed pip3 instead. Now, I want to use pip3 by typing pip only. The reason is I am used to t

9条回答
  •  感情败类
    2020-12-04 23:51

    Pip is installed in /usr/bin/. If you don't have pip at all, I would suggest to install pip3 only. Make sure you don't need older version.

    You can check available pip versions using following command.

    ls /usr/bin/pip*

    If you have multiple pip you need to prioritize your pip versions. I had only pip3 so I add it to the first priority. You can use following command and it is done.

    sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1

    You will get output as :

    update-alternatives: using /usr/bin/pip3 to provide /usr/bin/pip (pip) in auto mode

    Test now:

    pip --version

    You will get: pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

    If you have other version for python2.7, you can use same update command and change last digit 1 to 2. This will make it second priority.

提交回复
热议问题