0

I'm trying to install fastapi on my ubuntu machine (20.04) This PC has Python 2, Python3 (pointing to Python3.8) and Python3.9 installed.

If I try a pip3 install, it installs under Python3.8 I've seen a trick, using python3.9 -m pip3 ... but Python3.9 doesn't have the module pip or pip3.

I tried to install this using the get-pip.py trick, but it says there is no zlib. I then tried to install that using a few methods, the sudo apt-get zlib1g-dev method (which installs but doesn't fix the iussue) as well as one where you download zlib and ./configure and make it, which also appears to work but doesn't.

A lot of solutions suggest using yum, but there's no yum package - sudo apt-get install yum doesn't work, and it's not on the ubuntu package manager site.

I tried many things, but nothing worked so far.

Either I need to get zlib to work, or I need to get the existing pip packaged to point to 3.9 I suppose I could just use venvs (which is installed for 3.9, somehow, even though pip isn't! ) or I could just use 3.8 instead, but these are both workarounds.

What do, Stack Overflow?

Tobias S
  • 11
  • 2

1 Answers1

0

You should manually get the get-pip.py script.

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

(Found this on How to install pip for Python 3.9 on Ubuntu 20.04)

EDIT: venv is also installed with apt install python3-venv so it already could be without pip