Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 7072

How to set default python3 to python 3.9 instead of python 3.8 in Ubuntu 20.04 LTS [duplicate]

$
0
0

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/python3lrwxrwxrwx 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 -Vpip 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/python3lrwxrwxrwx 1 root root 9 Jul 19  2021 /usr/bin/python3 -> python3.8

Viewing all articles
Browse latest Browse all 7072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>