Skip to content

Instantly share code, notes, and snippets.

@gitcrtn
Created May 19, 2019 03:24
Show Gist options
  • Save gitcrtn/a577ad34e7878ea15c330feb41915ac8 to your computer and use it in GitHub Desktop.
Save gitcrtn/a577ad34e7878ea15c330feb41915ac8 to your computer and use it in GitHub Desktop.
Python Installation Steps for Clean Installed Ubuntu
# change repository location for japan
sudo sed -i.bak -e "s%http://us.archive.ubuntu.com/ubuntu/%http://ftp.jaist.ac.jp/pub/Linux/ubuntu/%g" /etc/apt/sources.list
sudo sed -i.bak -e "s%http://ja.archive.ubuntu.com/ubuntu/%http://ftp.jaist.ac.jp/pub/Linux/ubuntu/%g" /etc/apt/sources.list
sudo sed -i.bak -e "s%http://archive.ubuntu.com/ubuntu/%http://ftp.jaist.ac.jp/pub/Linux/ubuntu/%g" /etc/apt/sources.list
sudo apt update
# install dependencies
sudo apt install build-essential
sudo apt install zlib1g-dev libssl-dev libsqlite3-dev \
libbz2-dev libncurses5-dev libgdbm-dev \
liblzma-dev tcl-dev tk-dev libreadline-dev libffi-dev
# install pyenv
sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install git curl
curl https://pyenv.run | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
source ~/.bashrc
# install python3
pyenv install 3.7.2
pyenv global 3.7.2
pyenv rehash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment