8

I haven't found a way to install pip for python3.9 . When I run the command sudo apt install python3-pip it installs pip for pythpn3.8, not 3.9. If I try to use sudo apt install python3.9-pip it gives an error.

I want to install numpy, but if I use pip3 install numpy it installs it for python3.8 and not 3.9.

Ubuntu version is 20.04

2
  • 1
    What version of Ubuntu it matters.
    – David
    Apr 14, 2021 at 16:17
  • Yes sorry, Ubuntu 20.04
    – Unnamed
    Apr 14, 2021 at 17:07

1 Answer 1

11

You can install pip for python3.9 using get-pip.py as the official documentation as well as the github page describes it:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.9 get-pip.py

This script will also place binaries in your ~/.local/bin, so you can optionally add this directory to PATH.

echo 'export PATH=~/.local/bin/:$PATH' >> ~/.bashrc
source ~/.bashrc

When you do that, you might want to remove ~/.local/bin/pip and ~/.local/bin/pip3 and only keep ~/.local/bin/pip3.9 to not replace the already available commands.


Finally, check the proper installation:

$ pip3.9 -V
pip 21.0.1 from /home/user/.local/lib/python3.9/site-packages/pip (python 3.9)
2
  • Worked perfectly thanks!
    – Unnamed
    Apr 15, 2021 at 6:17
  • Note for me this REQUIRED linux to be rebooted. It just would not pick up the change otherwise.
    – Owl
    Mar 9, 2022 at 10:37

You must log in to answer this question.

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