I have installed Python 3.9 in Ubuntu 20.04 LTS. Now the system has both Python 3.8 and Python 3.9.
# which python # which python3 /usr/bin/python3 # which python3.8 /usr/bin/python3.8 # which python3.9 /usr/bin/python3.9 # ls -l /usr/bin/python3 lrwxrwxrwx 1 root root 9 Jul 19 2021 /usr/bin/python3 -> python3.8 But the pip3 command will still install everything into the Python 3.8 directory.
# pip3 install --upgrade --find-links file:///path/to/directory <...> I want to change that default pip3 behavior by updating the symbolic link /usr/bin/python3 to /usr/bin/python3.9.
How to do that?
# update-alternatives --set python3 /usr/bin/python3.9 This command will not work as expected.
Here is the pip3 info:
# which pip3 /usr/bin/pip3 # ls -l /usr/bin/pip3 -rwxr-xr-x 1 root root 367 Jul 13 2021 /usr/bin/pip3 # pip3 -V pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8) The alias command will not work:
# alias python3=python3.9 # ls -al /usr/bin/python3 lrwxrwxrwx 1 root root 9 Jul 19 2021 /usr/bin/python3 -> python3.8
python -m pip install ...