I want to switch my python version from 3.9.6 to 3.10 in paperspace. But it doesn’t work.
So I need your help.
device info
$root@nu1mmmnfz5:/notebooks/LoRA# cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.5 LTS"
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
$root@nu1mmmnfz5:/notebooks/LoRA# which python
/usr/local/bin/python
$root@nu1mmmnfz5:/notebooks/LoRA# ls /usr/local/bin/ | grep python
ipython
ipython3
python
python3
$ apt -y install python3.10
これが上手く入らないので苦戦しておりました。
$ python -V
Python 3.9.16
$ which python
/usr/local/bin/python
$ which python3
/usr/local/bin/python3
$ which python3.10
/usr/bin/python3.10
There are two, ‘usr/local/bin’ and ‘usr/bin’, and ‘apt -y install python3.10’ has gone into ‘usr/bin’.
Tried
$apt update -y
$apt upgrade -y
$apt -y install python3.10
3
Answers
You can install pyenv and you will be able to switch versions at will.
https://github.com/pyenv/pyenv
you can use
update-alternatives
to control python versionhttps://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux
maybe you should set the priority 0 or the same number
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.11 0
the best practice is not to change the system python version manually since many system services depend on it.
Also you should not install personal package using pip with root privilige for the same reason unless you know what it does.
you can use a version management to control the python env list like pyenv or conda