Install python3.6, pip3.6, pipenv on Ubuntu 14.04 LTS


OS: Ubuntu 14.04 LTS
Processor: 64 Bit

1. Install python3.6 From source

Step 1.1: Compile

$ wget
$ tar -xvf Python-3.6.3.tgz
$ cd Python-3.6.3
$ sudo ./configure --enable-optimizations

Step 1.2: Check

$ python3.6 --version

2. Install pip3.6

Step 2.1: Download pip

$ wget

Step 2.2: Execute

$ sudo python3.6

Step 2.3: If you Got below error

Error zlib not available

Traceback (most recent call last):
  File "", line 22711, in <module>
  File "", line 198, in main
  File "", line 82, in bootstrap
    from pip._internal.cli.main import main as pip_entry_point
zipimport.ZipImportError: can't decompress data; zlib not available

Step 2.3.1: Install zlib:

Install with some other dependency

$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev


You can install just zlib1g-dev

$ sudo apt-get install zlib1g-dev

Chances to get error

$ zlib1g-dev is already the newest version.

Just upgrade it if not new

$ sudo apt-get upgrade zlib1g-dev

Step 2.3.2: Now again try

$ sudo python3.6

If you get same error again, Then go for below steps:

Open Modules/Setup from folder ‘Python-3.6.3’ which we extracted on Step 1.1

$ sudo vim Modules/Setup

Uncomment the below line or jump on line no. 366

zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz

Now we need to again perform few operation from steps 1.1

$ sudo ./configure
$ sudo make install

Now run again & It should be work

$ sudo python3.6

Step 2.4: Let’s Install pipenv for testing purpose:

$ sudo pip3.6 install pipenv