Table of Contents
Reference
local
- Written in
$PWD/.python-version
- Overrides the global version
- Overridden by
PYENV_VERSION
or pyenv shell
command
$ pyenv local 2.7.6
$ pyenv local --unset
$ pyenv local 2.7.6 3.3.3
global
- Written in
$HOME/.pyenv/version
- Overridden by others
$ pyenv global 2.7.6
shell
- Specify a version just for the current shell
$ pyenv shell pypy-2.2.1
$ pyenv shell --unset
install
$ pyenv install 2.7.6
$ pyenv install 2.6.8
$ pyenv install --list
version
$ pyenv version
2.7.6 (set by /home/yyuu/.pyenv/version)
$ pyenv versions
2.5.6
2.6.8
* 2.7.6 (set by /home/yyuu/.pyenv/version)
3.3.3
jython-2.5.3
pypy-2.2.1
which
- Displays the full path to the executable
$ pyenv which python3.3
/home/yyuu/.pyenv/versions/3.3.3/bin/python3.3
whence
- Lists all Python versions with the given command installed
$ pyenv whence 2to3
2.6.8
2.7.6
3.3.3
virtualenv
- If eval
"$(pyenv virtualenv-init -)"
is configured in the shell, pyenv-virtualenv
will automatically activate/deactivate virtualenvs based on .python-version
file.
$ pyenv virtualenv 2.7.10 my-virtual-env-2.7.10 # specify a version for venv
$ pyenv my-virtual-env # based on current pyenv version
$ pyenv version
3.4.3 (set by /home/yyuu/.pyenv/version)
$ pyenv virtualenv venv34
$ pyenv virtualenvs
miniconda3-3.9.1 (created from /home/yyuu/.pyenv/versions/miniconda3-3.9.1)
miniconda3-3.9.1/envs/myenv (created from /home/yyuu/.pyenv/versions/miniconda3-3.9.1)
2.7.10/envs/my-virtual-env-2.7.10 (created from /home/yyuu/.pyenv/versions/2.7.10)
3.4.3/envs/venv34 (created from /home/yyuu/.pyenv/versions/3.4.3)
my-virtual-env-2.7.10 (created from /home/yyuu/.pyenv/versions/2.7.10)
* venv34 (created from /home/yyuu/.pyenv/versions/3.4.3)
$ pyenv activate <name>
$ pyenv deactivate
$ pyenv uninstall my-virtual-env
How-to
Fix common build problems