Skip to content

HOWTO.install python3.6 from sources

Requirements

  • root
  • make and others gcc libs
# debian, ubuntu
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev zlib1g-dev

# rhel, centos
sudo yum install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev zlib-devel

In order to install the latest Python 3.6 release for Linux/UNIX, go to their official website and download its source code to your server. At the moment of writing this article, it is version 3.6.8

wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz

Change the current working directory and run the ‘configure’ script

cd Python-3.6.8
./configure --enable-optimizations  

## note: for quick installation, do not enable optimizations
./configure
If there are no errors, run the following commands to complete the installation process of Python 3.6

make -j8 
sudo make install

# note: in case your machine already has python3 being used for OS internal devices (i.e ubuntu for display drivers)
# you may need to use the command below instead
sudo make altinstall

That’s all. Python 3.6 should be successfully installed at this point. Restart your session.
You can check this with the following command:

# python3.6 -V
Python 3.6.8