jack8000
jack8000

Reputation: 17

How to install pip globally on Ubuntu 20.04, so that all users can use it the same way?

I set up a VMware machine under Windows 10, running Ubuntu 20.04.

The first thing I did after the installation was to install pip:

sudo apt install python3-pip

I then did:

sudo pip3 install --upgrade pip3

to which I got an error saying that the package pip3 doesn't exist. So I did:

sudo pip3 install --updgrade pip

which finished and installed pip 21.0.1

Now if I run pip3 with sudo, I have to type sudo pip3, but for a non-root user I have to use pip insted of pip3

sudo pip3 --version and sudo pip --version and pip --version return the same:

pip 21.0.1 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)

But pip3 --version returns: bash: /usr/bin/pip3: No such file or directory

I just want to use the command pip3 both with and without root privilige and I don't understand what's happening here.

Upvotes: 1

Views: 1472

Answers (1)

phd
phd

Reputation: 94511

bash: /usr/bin/pip3: No such file or directory

This is because bash still remembers where it saw pip3 last time and the place was changed from /usr/bin/pip3 to /usr/local/bin/pip3. To clear its memory run hash -r. See command hash in bash manual.

Upvotes: 4

Related Questions