I am new to Azure and need to upgrade the Python version in the Cloud Shell from 3.9.x to 3.10.x. Can someone suggest a method for upgrading it?
Thank you!
I have a program that runs only on Python 3.10.x but i want to try to run it on cloud because i dont have that many resources myself. I was hoping there was some way to upgrade that python version so I can use it easily. And also i did try sudo apt install python
but then it asks for sudo password and i have never setup and sudo password in that account and I couldn't find any default one on google so if there is some then please let me know.
sudo apt install python
won't work in Azure cloud shell environment. Because sudo is not accessible directly in cloud shell as it is managed by the Microsoft environment. In order to achieve your requirement, there are few workarounds which are detailed below.
Firstly, you can download the 3.10.0
version from Python.org releases using curl
command as shown below.
curl -o ~/python-3.10.0.tar.xz https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz
tar -xf ~/python-3.10.0.tar.xz
Once it is installed properly, create a virtual environment under python-3.10.0
directory and proceed with the code executions accordingly. Now the virtual environment is all set to use python 3.10
version.
python3 -m venv ~/venvlatest
source ~/venvlatest/bin/activate
The above is for activating the virtual environment. Once you are done with your requirements, you can deactivate it with just giving deactivate
command.
Alternatively, you can also pyenv tool which is mainly used to switching or managing between multiple versions of python with pyenv
.
And the other workaround for upgrading python versions is by installing its library dependencies such as miniconda which is clearly given in this Microsoft Q&A.