First, you need git.
$ sudo yum install git
// type yes to all questions
$ git version
git version 2.23.3
Then install pyenv by cloning from GitHub.
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
Create the paths for pyenv.
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
// Check if the paths are created correctly.
$ pyenv -v
pyenv 1.2.20-5-g1ec3c6f1
Install the necessary dependencies.
sudo yum install gcc zlib-devel bzip2 bzip2-devel readline readline-devel sqlite sqlite-devel openssl openssl-devel libffi-devel -y
Install python.
$ pyenv install 3.7.0
// This will take several minutes to complete
Choose 3.7.0 as the global version.
$ pyenv global 3.7.0
$ pyenv rehash
$ python --version
3.7.0
References
EC2サーバにPython3環境構築
pyenvで3.7系のインストールに失敗したときのメモ
Sorry, only Japanese versions are available.
Top comments (0)