Skip to content

Commit bb5b1e6

Browse files
committed
Add information on pyenv
1 parent fc48746 commit bb5b1e6

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

docs/dev/env.rst

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,32 @@ For example, you can work on a project which requires Django 1.3 while also
232232
maintaining a project which requires Django 1.0.
233233

234234
To start using and see more information:
235-
`Virtual Environments <http://github.com/kennethreitz/python-guide/blob/master/docs/dev/virtualenvs.rst>`_ docs.
235+
`Virtual Environments <http://github.com/kennethreitz/python-guide/blob/master/docs/dev/virtualenvs.rst>`_ docs.
236+
237+
238+
pyenv
239+
-----
240+
241+
`pyenv <https://github.com/yyuu/pyenv>`_ is a tool to allow multiple versions
242+
of the Python interpreter to be installed at the same time. This solves the
243+
problem of having different projects requiring different versions of Python.
244+
For example, it becomes very easy to install Python 2.7 for compatibility in
245+
an one project, whilst still using Python 3.4 as the default interpreter.
246+
pyenv isn't just limited to the CPython versions - it will also install PyPy,
247+
anaconda, miniconda, stackless, jython, and ironpython interpreters.
248+
249+
pyenv works by filling a ``shims`` directory with fake versions of the Python
250+
interpreter (plus other tools like ``pip`` and ``2to3``). When the system
251+
looks for a program named ``python``, it looks inside the ``shims`` directory
252+
first, and uses the fake version, which in turn passes the command on to
253+
pyenv. pyenv then works out which version of Python should be run based on
254+
environment variables, ``.python-version`` files, and the global default.
255+
256+
pyenv isn't a tool for managing virtual environments, but there is a plugin
257+
`pyenv-virtualenv <https://github.com/yyuu/pyenv-virtualenv>`_ which automates
258+
the creation of different environments, and also makes it possible to use the
259+
existing pyenv tools to switch to different environments based on environment
260+
variables or ``.python-version`` files.
236261

237262
Other Tools
238263
:::::::::::

0 commit comments

Comments
 (0)