0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【AmazonLinux】Python2系からPython3系への切り替え

Last updated at Posted at 2019-11-17

環境

AMI: Amazon Linux AMI 2018.03.0 (HVM), SSD Volume Type

コマンド

   $  sudo yum install python36
   $  python3 --version
   $  sudo yum install git
   $  git clone git://github.com/yyuu/pyenv.git ~/.pyenv
   $  emacs ~/.bash_profile
   $  source ~/.bash_profile
   $  sudo yum install zlib1g-dev
   $  sudo yum install libssl-dev
   $  sudo yum install gcc zlib-devel bzip2 bzip2-devel readline readline-devel sqlite sqlite-devel openssl openssl-devel -y
   $  pyenv install 3.6.8
   $  pyenv global 3.6.8
   $  pyenv rehash
   $  python --version

.bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

確認方法

$ python --version

の実行結果が3系になっていれば大丈夫のはず

参考サイト

Linux での Python のインストール
Pythonを2から3に切り替えよう!!
EC2サーバにPython3環境構築

ブログでもまとめていますのでよろしくお願いします

【AmazonLinux】Python2系からPython3系への切り替えコマンド

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?