Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change pip3 command to be pip?

Tags:

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?

like image 261
Ambitions Avatar asked Jun 09 '17 10:06

Ambitions


People also ask

How do I use pip instead of pip3?

You have to use pip3 for it to be installed on Python3. So to install packages in python3, you should use pip3. NOTE:- Its not necessary that pip will install in python 2.7, if python2 is absent then pip will do it in python3. The above statement was if you have both the version of python installed.

Is pip same as pip3?

pip3 is an updated version of pip which is used basically for python 3+. Depending on what is first in the system PATH variable, the system will utilize one of your Python versions. You can be sure that the module will be installed in Python 3 when you run PIP3.

Why does pip3 work but not pip?

The pip: command not found error is raised if you do not have pip installed on your system, or if you've accidentally used the pip command instead of pip3. To solve this error, make sure you have installed both Python 3 and pip3 onto your system.

How do I switch from pip to Python 3?

Install setuptools for Python3 : apt-get install python3-setuptools. Now pip for Python3 could be installed by: python3 -m easy_install pip. Now you can use pip with the specific version of Python to install package for Python 3 by: pip-3.2 install [package]


2 Answers

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,

like image 67
MacHala Avatar answered Dec 06 '22 07:12

MacHala


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 
like image 31
c z Avatar answered Dec 06 '22 06:12

c z