sudo apt-get install -y build-essential checkinstall
sudo apt-get install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
cd ~/Libraries
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar -xvf Python-2.7.13.tgz
cd Python-2.7.13
sudo ./configure --enable-shared --enable-unicode=ucs4 --enable-optimizations
sudo make
sudo make install
It is necessary for --enable-shared when ./configure
gedit ~/.bash_aliases
alias python='/usr/local/bin/python2.7'
save and leave
source ~/.bashrc
or
source ~/.zshrc
python --version
set linking
sudo ldconfig
which python
'which' process may display your python installed path
gedit ~/.bashrc
or
gedit ~/.zshrc
add 'export PATH=(your python installed path):$PATH' at the bottom of editor
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py
sudo python get-pip.py
If you want to install libraries related to python, using below code
sudo python -m pip install ~~ (ex.scrapy)