sudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt install python3.9 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2 python3 --version sudo apt remove --purge python3-apt sudo apt autoclean sudo apt install python3-apt sudo apt install python3.9-distutils curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py sudo python3.9 get-pip.py these commands helped me upgrade python to python3.9 and installed pip for the python3.9 version.