Here is the step by step guide to install
Python 3.6.3 in your AWS EC2's Ubuntu 16.04 server instance or in your local machine with Ubuntu 16.04 LTS Desktop or in Linux Mint.
Note: If you are using Ubuntu 18.04 LTS, then it ships with Python 3.6.3 by default.
Check which Python version is pre-installed in the system by typing
$ python3 -V in the terminal. Generally it is
Python 3.5.2 for Ubtuntu 16.04 LTS.
First you need to upgrade and update your system.
$ sudo apt update && sudo apt -y upgrade
Then you need to install
zlib1g-devpackage because of this issue.
$ sudo apt -y install zlib1g-devTo make sure it is installed correctly, type
$ cat /usr/include/zlib.h. It'll show you the source of
Because of this issue, you also have to install another package called
$ sudo apt install libreadline-dev
build-essentialand other bunch of stuffs which is required by
$ sudo apt install build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
These packages are needed for setting up SSL for downloading packages over PIP, for setting up
g++and so on.
LD_LIBRARY_PATHfor secure SSL connection.
$ export LD_LIBRARY_PATH=/usr/local/ssl/lib/
Begin installation of Python 3.6.3
First, download tar zipped file from Python FTP server.
Extract the zipped file:
$ tar zxvf Python-3.6.3.tgz
Move Python3.6.3 directory to
$ sudo mv Python-3.6.3 /opt/
$ cd /opt/Python-3.6.3/
Configure Python directory.
Test the Make if you want (this is optional)
$ make test
Install it via Make:
sudo make install
Verify that Python 3.6.3 is installed in your system by typing
If it again shows Python 3.5.2 then type
$ python3.6. To make things easier, set up an alias. To set up alias do the following:
.bashrcfile located in your home directory.
$ nano ~/.bashrc
Add following line at the end
At this point, Python 3.6.3 is correctly installed in your system
Make sure yout PIP is correct. In Python2 is
pipand in Python3 its
$ pip3 -Vshows you which Python it is pointing to.
If you are using
pyodbcthen you need to install
$ sudo apt -f install unixodbc-dev
Then you can insall
$ pip3 install pyodbc