-
Notifications
You must be signed in to change notification settings - Fork 157
Install Python via pyenv
Mario Cho edited this page Jun 21, 2019
·
13 revisions
We highly recommend pyenv to install multiple Python versions side-by-side, which does not interfere with system-default Pythons.
$ sudo apt-get update -y
$ sudo apt-get dist-upgrade -y
$ sudo apt-get install -y \
> gcc g++ git make \ # for generic C/C++ builds
> libreadline-dev libsqlite3-dev libssl-dev libbz2-dev \ # for Python builds
> libzmq3-dev libsnappy-dev # for Backend.AI dependency builds
$ sudo yum update
$ yum install -y \
> gcc g++ git make \ # for generic C/C++ builds
> libreadline-dev libsqlite3-dev libssl-dev libbz2-dev \ # for Python builds
> libzmq3-dev libsnappy-dev # for Backend.AI dependency builds
$ curl https:\\pyenv.run | bash
NOTE: Change ~/.profile
accroding to your shell/system (e.g., ~/.bashrc
, ~/.bash_profile
, ~/.zshrc
, ...) -- whichever loaded at startup of your shell!
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
$ echo 'eval "$(pyenv init -)"' >> ~/.profile
$ exec $SHELL -l
$ pyenv # check installation
pyenv 1.2.0-6-g9619e6b
Usage: pyenv <command> [<args>]
Some useful pyenv commands are:
...
$ git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
...
$ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.profile
$ exec $SHELL -l
$ pyenv virtualenv # check installation
pyenv-virtualenv: no virtualenv name given.
Install Python 3.6 latest version.
NOTE: Currently Python 3.7 is not supported yet.
$ pyenv install 3.6.8
Change myvenv
to specific names required in other guide pages.
$ pyenv virtualenv 3.6.8 myvenv
$ pyenv shell myvenv
$ cd some-directory
$ pyenv local myvenv
💡 |
|