mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Update README about usage with multiple versions (#92)
This commit is contained in:
parent
56c58e2778
commit
20e5404248
1 changed files with 88 additions and 33 deletions
121
README.md
121
README.md
|
@ -299,21 +299,38 @@ file named `.pyenv-version`. For backwards compatibility, pyenv will
|
||||||
read a local version specified in an `.pyenv-version` file, but a
|
read a local version specified in an `.pyenv-version` file, but a
|
||||||
`.python-version` file in the same directory will take precedence.
|
`.python-version` file in the same directory will take precedence.
|
||||||
|
|
||||||
**pyenv feature**
|
#### pyenv local (advanced)
|
||||||
|
|
||||||
You can specify multiple versions as local Python. Commands
|
You can specify multiple versions as local Python at once.
|
||||||
within these Python versions are searched by specified order.
|
|
||||||
|
Let's say if you have two versions of 2.7.6 and 3.3.3. If you prefer 2.7.6 over 3.3.3,
|
||||||
|
|
||||||
$ pyenv local 2.7.6 3.3.3
|
$ pyenv local 2.7.6 3.3.3
|
||||||
$ pyenv local
|
$ pyenv versions
|
||||||
2.7.6
|
system
|
||||||
3.3.3
|
* 2.7.6 (set by /Users/yyuu/path/to/project/.python-version)
|
||||||
$ pyenv which python2.7
|
* 3.3.3 (set by /Users/yyuu/path/to/project/.python-version)
|
||||||
/home/yyuu/.pyenv/versions/2.7.6/bin/python2.7
|
$ python --version
|
||||||
$ pyenv which python3.3
|
Python 2.7.6
|
||||||
/home/yyuu/.pyenv/versions/3.3.3/bin/python3.3
|
$ python2.7 --version
|
||||||
$ pyenv which python
|
Python 2.7.6
|
||||||
/home/yyuu/.pyenv/versions/2.7.6/bin/python
|
$ python3.3 --version
|
||||||
|
Python 3.3.3
|
||||||
|
|
||||||
|
or, if you prefer 3.3.3 over 2.7.6,
|
||||||
|
|
||||||
|
$ pyenv local 3.3.3 2.7.6
|
||||||
|
$ pyenv versions
|
||||||
|
system
|
||||||
|
* 2.7.6 (set by /Users/yyuu/path/to/project/.python-version)
|
||||||
|
* 3.3.3 (set by /Users/yyuu/path/to/project/.python-version)
|
||||||
|
venv27
|
||||||
|
$ python --version
|
||||||
|
Python 3.3.3
|
||||||
|
$ python2.7 --version
|
||||||
|
Python 2.7.6
|
||||||
|
$ python3.3 --version
|
||||||
|
Python 3.3.3
|
||||||
|
|
||||||
### pyenv global
|
### pyenv global
|
||||||
|
|
||||||
|
@ -330,21 +347,38 @@ The special version name `system` tells pyenv to use the system Python
|
||||||
When run without a version number, `pyenv global` reports the
|
When run without a version number, `pyenv global` reports the
|
||||||
currently configured global version.
|
currently configured global version.
|
||||||
|
|
||||||
**pyenv feature**
|
#### pyenv global (advanced)
|
||||||
|
|
||||||
You can specify multiple versions as global Python. Commands
|
You can specify multiple versions as global Python at once.
|
||||||
within these Python versions are searched by specified order.
|
|
||||||
|
Let's say if you have two versions of 2.7.6 and 3.3.3. If you prefer 2.7.6 over 3.3.3,
|
||||||
|
|
||||||
$ pyenv global 2.7.6 3.3.3
|
$ pyenv global 2.7.6 3.3.3
|
||||||
$ pyenv global
|
$ pyenv versions
|
||||||
2.7.6
|
system
|
||||||
3.3.3
|
* 2.7.6 (set by /Users/yyuu/.pyenv/version)
|
||||||
$ pyenv which python2.7
|
* 3.3.3 (set by /Users/yyuu/.pyenv/version)
|
||||||
/home/yyuu/.pyenv/versions/2.7.6/bin/python2.7
|
$ python --version
|
||||||
$ pyenv which python3.3
|
Python 2.7.6
|
||||||
/home/yyuu/.pyenv/versions/3.3.3/bin/python3.3
|
$ python2.7 --version
|
||||||
$ pyenv which python
|
Python 2.7.6
|
||||||
/home/yyuu/.pyenv/versions/2.7.6/bin/python
|
$ python3.3 --version
|
||||||
|
Python 3.3.3
|
||||||
|
|
||||||
|
or, if you prefer 3.3.3 over 2.7.6,
|
||||||
|
|
||||||
|
$ pyenv global 3.3.3 2.7.6
|
||||||
|
$ pyenv versions
|
||||||
|
system
|
||||||
|
* 2.7.6 (set by /Users/yyuu/.pyenv/version)
|
||||||
|
* 3.3.3 (set by /Users/yyuu/.pyenv/version)
|
||||||
|
venv27
|
||||||
|
$ python --version
|
||||||
|
Python 3.3.3
|
||||||
|
$ python2.7 --version
|
||||||
|
Python 2.7.6
|
||||||
|
$ python3.3 --version
|
||||||
|
Python 3.3.3
|
||||||
|
|
||||||
### pyenv shell
|
### pyenv shell
|
||||||
|
|
||||||
|
@ -366,17 +400,38 @@ prefer not to use shell integration, you may simply set the
|
||||||
|
|
||||||
$ export PYENV_VERSION=pypy-2.2.1
|
$ export PYENV_VERSION=pypy-2.2.1
|
||||||
|
|
||||||
**pyenv feature**
|
#### pyenv shell (advanced)
|
||||||
|
|
||||||
You can specify multiple versions via `PYENV_VERSION`
|
You can specify multiple versions via `PYENV_VERSION` at once.
|
||||||
environment variable in your shell.
|
|
||||||
|
|
||||||
$ pyenv shell pypy-2.2.1 2.7.6
|
Let's say if you have two versions of 2.7.6 and 3.3.3. If you prefer 2.7.6 over 3.3.3,
|
||||||
$ echo $PYENV_VERSION
|
|
||||||
pypy-2.2.1:2.7.6
|
$ pyenv shell 2.7.6 3.3.3
|
||||||
$ pyenv version
|
$ pyenv versions
|
||||||
pypy-2.2.1 (set by PYENV_VERSION environment variable)
|
system
|
||||||
2.7.6 (set by PYENV_VERSION environment variable)
|
* 2.7.6 (set by PYENV_VERSION environment variable)
|
||||||
|
* 3.3.3 (set by PYENV_VERSION environment variable)
|
||||||
|
$ python --version
|
||||||
|
Python 2.7.6
|
||||||
|
$ python2.7 --version
|
||||||
|
Python 2.7.6
|
||||||
|
$ python3.3 --version
|
||||||
|
Python 3.3.3
|
||||||
|
|
||||||
|
or, if you prefer 3.3.3 over 2.7.6,
|
||||||
|
|
||||||
|
$ pyenv shell 3.3.3 2.7.6
|
||||||
|
$ pyenv versions
|
||||||
|
system
|
||||||
|
* 2.7.6 (set by PYENV_VERSION environment variable)
|
||||||
|
* 3.3.3 (set by PYENV_VERSION environment variable)
|
||||||
|
venv27
|
||||||
|
$ python --version
|
||||||
|
Python 3.3.3
|
||||||
|
$ python2.7 --version
|
||||||
|
Python 2.7.6
|
||||||
|
$ python3.3 --version
|
||||||
|
Python 3.3.3
|
||||||
|
|
||||||
### pyenv versions
|
### pyenv versions
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue