Install and Run Different Python Interpreters
Your operating system comes with a specific version of Python. At the time of this writing, the version is probably around 2.7.
It is best to not change this version as some system links my depend on this version of Python. If you move or edit your default version, you may cause other programs in your system to not work properly.
With brew you can install Python version 2 and 3, but may only be able to get 3.3 or whatever is available to tap at the time. Many times brew version will be not the most current. Also when installing with brew you are installing the version system wide and this makes it difficult to easily switch interpreter types and versions for different project requirements.
There are tools and utilities to help with installing and running different
versions of Python. I had issues getting them to work properly for me, and
sometimes they were too complicated. I have tried
pythonz and also
pyenv. Using these tools along with virtualenvwrapper I had the most
For my Python version management, I combine two tools,
pyenv to download and update the different versions of Python
interpreters and that is all I use it for. Setting up pyenv-virtualenvwrapper and its
configuration was a little too involved.
After downloading a few versions of Python interpreters, I will have the following directories:
In each of the above directories there will be a
containing the executable.
Now I can use
virtualenvwrapper and the above directory with the
-p flag to specify the Python version.
I create a differenct virtualenv for each Python version I need for a project.
mkproject -p ~/.pyenv/versions/3.4.3/bin/python3.4 ENVNAME
mkproject -p ~/.pyenv/versions/pypy-4.0.0/bin/pypy ENVNAME
I like to use
pyenv to download and maintain different Python
interpreters and their versions.
I then use
virtualenvwraper to create virtualenvs with the downloaded