I am creating a serverless function with the help of python. but when I try to enable it it says you have python 3.5.
how do I install python 3.6 on the azure cloud shell that we access to at portal.azure.com?
It sounds like you want to install Python 3.6 instead of Python 3.5 on Azure Cloud Shell, as the figure below.

Let's first check the OS version in Azure Cloud Shell via lsb_release -a and uname -a, as the figure below.

According to the result of the figure above, I see it's an Ubuntu 16.04 x86_64 version. And to check the filesystem information via df -a, as the figure below, I also see it's just an Ubuntu Docker image.

I tried to do the normal install operations of Ubuntu via sudo apt-get install python3.6 or apt-get install python3.6, but failed because there is no sudo command and no root permission for the current user, as the figure below.

So the only workaround is to download a pre-compiled Python 3.6 release to install on it. The offical Python website only releases the archive file of source codes with tar.gz suffix, not pre-compiled version for Linux, it's too complex to cost long time to compile Python source code to get a Python runtime via gcc and its library dependencies, so finally I decided to install a miniconda release of Python 3.6, which comes from https://repo.continuum.io/miniconda/, and what I used is https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh.
Here is my steps and screenshots.
Directly to download the installation shell file Miniconda3-4.5.4-Linux-x86_64.sh and install it via commands
wget https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh
and
sh Miniconda3-4.5.4-Linux-x86_64.sh.

The default installation path is ~ that absoluted path is /home/<your username>. You just need to configure the environment variable PATH via command
export PATH=~/miniconda3/bin:$PATH
then Python 3.6 of Anaconda will works fine for you, as the figure below.

Even you switch to PowerShell, to follow the figure below to do the operations also can use Python 3.6 of Anaconda.
# PowerShell on Azure Cloud Shell
cd ~
cd miniconda3/bin
./python -V

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With