$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install git gcc make openssl libssl-dev libbz2-dev libreadline-dev libsqlite3-dev
$ cd /usr/local/
$ sudo git clone git://github.com/yyuu/pyenv.git ./pyenv
$ sudo mkdir -p ./pyenv/versions ./pyenv/shims
$ cd /usr/local/pyenv/plugins/
$ sudo git clone git://github.com/yyuu/pyenv-virtualenv.git
$ echo 'export PYENV_ROOT="/usr/local/pyenv"' | sudo tee -a /etc/profile.d/pyenv.sh
$ echo 'export PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"' | sudo tee -a /etc/profile.d/pyenv.sh
$ source /etc/profile.d/pyenv.sh
$ pyenv --version
sudo vi /etc/sudoers
#Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
Defaults env_keep += "PATH"
Defaults env_keep += "PYENV_ROOT"
$ pyenv install --list ###Vérifiez la version installable
$ sudo pyenv install -v 2.7.13
$ sudo pyenv install -v 3.6.1
$ python --version
Python 2.7.6
$ pyenv versions
* system (set by /usr/local/pyenv/version)
2.7.13
3.6.1
$ sudo pyenv global 2.7.13
$ python --version
Python 2.7.13
$ pyenv versions
system
* 2.7.13 (set by /usr/local/pyenv/version)
3.6.1
Recommended Posts