Install python 2.7.13 on ubuntu 18.04

hogeol·2022년 3월 5일
0

Ubuntu

목록 보기
3/12
  1. Install dependency

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

  1. Download python 2.7.13 && install
    (I download python on my Library directory, you should download in any directory you want)

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

  1. make default python 2.7.13 (It can be confused existing python)

gedit ~/.bash_aliases

alias python='/usr/local/bin/python2.7'

save and leave

source ~/.bashrc

or

source ~/.zshrc

  1. check your python version

python --version

set linking

sudo ldconfig

  1. export python path in shell

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

  1. Install pip

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py
sudo python get-pip.py

  1. Additional

If you want to install libraries related to python, using below code

sudo python -m pip install ~~ (ex.scrapy)

0개의 댓글