1
0

More than 3 years have passed since last update.

EC2(ubuntu) に pyenv で python 環境構築

Last updated at Posted at 2020-11-03

目次

  1. 環境確認
  2. 手順確認

1. 環境確認

  • os:ubuntu(18.04.5)
  • ec2インスタンスタイプ:t2.micro

2. 手順確認

2.1 依存関係のインストール

sudo apt-get install git gcc make openssl zlib1g-dev libssl-dev libbz2-dev libreadline-dev libsqlite3-dev

2.2 pyenv をクローン

git clone https://github.com/yyuu/pyenv.git ~/.pyenv

2.3 .bashrc に以下を記述

export PYENV_ROOT="${HOME}/.pyenv"
if [ -d "${PYENV_ROOT}" ]; then
export PATH=${PYENV_ROOT}/bin:$PATH
eval "$(pyenv init -)"
fi

2.4 .bashrc を再読み込み

source ~/.bashrc

2.5 目的のバージョンをインストール

pyenv install 3.7.3

2.6 バージョン切り替え

pyenv global 3.7.3

2.7 確認

python -V
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0