How to change pip3 command to be pip?

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 type pip only and every guide uses the pip command, so every time I want to copy and paste commands, I have to modify pip to pip3 which wastes time. When I type pip I have an error which is pip: command not found which means pip command is not taken. Is it possible to make pip points to pip3?


you can either add alias to your ~/.bashrc

alias pip=pip3

or add to your $PATH symlink named pip pointing to pip3 binary

(btw, this even though concerning pip isn't really python related question, so you should retag it)

Update: July 2020

If there is no ~/.bashrc in your home directory on macOS, inputting

alias pip=pip3

in your ~/.zprofile file has the same effect,


Rather than manually creating your own alias in bash and hoping this doesn't conflict with anything, most package managers should allow you to register the version you wish to use whilst maintaining dependencies.

For instance on Linux:

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

Or on Mac (MacPorts):

port select --set pip pip3

Solution 1

Check which version pip is pointing to

pip --version
pip 18.0 from /usr/lib/python2.7/site-packages/pip (python 2.7)

If your pip is pointing to pip2, locate where is the pip "binary".

which pip
/usr/bin/pip

This is a simple python script:

cat /usr/bin/pip
#!/usr/bin/python2

# -*- coding: utf-8 -*-
import re
import sys

from pip._internal import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

So just change the shebang from #!/usr/bin/python2 to #!/usr/bin/python3.

Now pip is pointing to pip3.

pip --version         
pip 18.0 from /usr/lib/python3.6/site-packages/pip (python 3.6)

Solution 2

Remove /usr/bin/pip make make a symbolic link from the wanted pip version to it instead.

sudo rm /usr/bin/pip
sudo ln -s /usr/bin/pip3.6 /usr/bin/pip

Since you uninstalled pip, this solution assumes you're only going to use pip3.

  1. Open your terminal.

  2. Create a simple link. To do that type:

    sudo ln -s /usr/bin/pip3 /usr/bin/pip

Now when you type pip, it will invoke pip3.

Check that it worked by typing pip --version

pip --version   
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

You're all set!


You can write pip for pip3 after changing bashrc file in the home directory.

In mac -

Open bashrc file -

vim ~/.bashrc

Add this line at the end of the file -

alias pip="pip3"

Close the file. Don't forget to source this file in the terminal by

source ~/.bashrc

You are good to go. Now, whenever you will use pip in any command. it will be interpreted as pip3

You can check it by running the command -

pip --version