My default python is 2.7 and I want python 3.7 along with it:
- Go to opt directory
$ cd /opt
- Create a directory
$ mkdir python3
- Download Python 3.7
$ wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
- Extract the python 3.7 tar file
$ tar xzf Python-3.7.4.tgz
- To compile the source go to
$ cd Python-3.7.
4 - To get release build with all stable optimizations active (PGO, etc), execute
$ sudo ./configure --enable-optimizations
Inside Python-3.7.4 directory - To prevent replacing of default python binary file /usr/bin/python, use
$ sudo make altinstall
- To confirm the installation use $ python3.7 –version and which python3.7