I installed a Django package on GCP (Debian 9 OS), that comes with the following softwares:
When I type the command python -V
I get the following python version: 2.17.13
When I type python3 -V
I get the following version: 3.7.6
How can I uninstall the previous version permanently and keep the current one as the default?
Here's what I tried and I didn't work:
$ ls /usr/bin/python*
usr/bin/python /usr/bin/python2.7 /usr/bin/python3.5 /usr/bin/python3m /usr/bin/python2 /usr/bin/python3 /usr/bin/python3.5m
# update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
Returns nothing
# update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2
Returns nothing
I would not recommend uninstalling python2. Install python3 and make sure the directory where you install it is included in your systems $PATH variable. You will need to do something like this. Note, depending on how you install python3, some installers will automatically update your $PATH variable.
Example installing python3 in "/Library/Frameworks/python3" directory.
Show current $PATH variable.
echo $PATH
update .bashrc in home directory (append to current $PATH)
PATH="/Library/Frameworks/python3:${PATH}"
reload .bashrc (or exit and start terminal back up)
. ~/.bashrc
Confirm correct python install will be run when typing python3 into terminal.
$which python3
/Library/Frameworks/python3