I am new to python and I am planning to learn django. I had a bit of experience with ruby (not rails) and I am familiar with RVM however I don\'t understand the
Since all the answers above are pretty old, I'd like to summarize my findings here. I was trying to figure out how this works with Python after coming from rvm/ruby and could not find a clear explanation anywhere online.
So we have the following options on Macos:
...Can install python
and python3
. They will be stored in Homebrew's Cellar and symlinked from /usr/local/bin
. Default python
installed using brew
is 2.7.6 as of now.
Packages installed using pip
will go in default location (you also have pip
and pip3
symlinked as well).
...Is an alternative to Homebrew (on Macos) way to install and maintain multiple versions of Python. Linux does not have Homebrew so Pyenv is kind of a specialized version of it just for Python. It also builds Python from source.
Pyenv keeps python installations in ~/.pyenv/versions/
and allows to quickly switch between and use same names for binaries (python
, pip
etc). It uses "shim" binaries which are fake binaries like python
, pip
etc which mimic Python's and instead just silently redirect execution to the currently active version.
Packages installed using pip
will go into active Python installation.
So, neither of those methods really enough to maintain separate python installations and package version sets (like rvm does with gemsets) per project. Hence:
...Is the closest thing to rvm. To quote this post:
it sets up a clean copy of Python in a new directory by copying or linking files from your primary Python installation to create new bin and lib directories
So it uses the currently active copy of Python and copies it into a separate directory. virtualenvwrapper
adds functionality to manage those environments and automatically activate them using cd
just like rvm
does.
This allows to isolate python version and libraries installed used for each project. However, it does not install python
versions itself.
Thus, sounds like most people use a combination of pyenv
+ virtualenv
or brew
+ virtualenv
(brew is Macos specific of course). The first part is used to install python versions (if needed) and the second one is to clone them for different projects and switch between them.
PS: I am just starting to figure it out, please correct me if anything here is wrong.
PPS: It seems to me that this whole business can be improved by combining pyenv and virtualenv under one roof...