# Install and use multiple Python versions

First, we need to list the all available versions of Python, including Anaconda, Jython, pypy, and stackless in our system. Use the following command to list them all:

```
$ pyenv install --list
```

Now, that you have a list you can decide which versions of Python you want to install. You can install the desired versions with the following command:

```
$ pyenv install 3.5.2
$ pyenv install 2.7.12
```

Last step before use the desired version, now that you have installed the latest and required version we need to set the priority of the version to use. The `global` command allows us to set global version(s) of Python to be used in all shells. Thus, if we want to use version 2.7.12 over version 3.5.2 following command will do the trick:

```
$ pyenv global 2.7.12 3.5.2
$ pyenv rehash
```

Remember, the leading version always takes priority so in our case v2.7.12 is going to be the default.

&#x20;All installed Python versions can be located in `~/.pyenv/versions`. Alternatively, you can run:

```
$ pyenv versions
  system (set by /Users/your_account/.pyenv/version)
* 2.7.12
* 3.5.2
```

This shows an asterisk `*` next to the currently active version.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mac-python.gitbook.io/python-mac/option-2-pyenv-it/install-multiple-python-versions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
