1

I would like to install pip for python 3. I check the following on my computer:

which python3
python3 --version

which return

/usr/bin/python3
Python 3.5.2

Since, I already installed python3. I dediced to install pip3 along typing

sudo apt install python3-pip

But I get

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pip is already the newest version (8.1.1-2ubuntu0.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

which means that maybe pip3 is already installed? Then I tried

which pip3 

I got nothing, and

pip3 --version

just to be sure but it returns

The program 'pip3' is currently not installed. You can install it by typing:
sudo apt install python3-pip

which proposed me the command I already tried.

What is happening here?

What do I need to do to get pip3 properly?

2
  • Is the pip command working, or pip3.5 or similar?
    – Kusalananda
    Feb 19, 2019 at 19:04
  • Yes, pip is working.
    – Many
    Feb 20, 2019 at 7:12

1 Answer 1

0

Run these commands to fix your installation:

sudo apt purge python3-pip
sudo rm -rf /usr/lib/python3/dist-packages/pip
rm -rf ~/.local/lib/python3.5/site-packages/pip
sudo apt install python3-pip

(See here)

But I find it's very easy to break it again. There is a lot of talking about it:


Instead of invoking pip3 from its bin-script, you can always use:

python3 -m pip --version

or every other command:

python3 -m pip install package

Add an alias to your e.g. .bashrc to make pip3 work as it should:

alias pip3='python3 -m pip'
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .