pyenv - Simple Python version management
I haven't posted much about python lately, and since I didn't see much about using pyenv, I thought I'd post my thoughts on it. The project 'pyenv' is a version manager for python -- which I use in combination with virtualenv whenever I start a new project and want to setup my development environment. It replaces pythonbrew, which had stopped being an active project almost 8 months ago. Anyhow, pyenv works a lot like rbenv, which installs the binaries and uses 'shims' to access the different versions of python.
So why do I use something like pyenv? Well, I don't like polluting my system with extra
Look at the link for more details, but this is how I install on a fresh laptop.
I clone the repo to my home:
git clone git://github.com/yyuu/pyenv.git ~/.pyenv
On my terminal, I edit my .bash_profile or .bashrc and add:
if [ -d "$HOME/.pyenv" ] ; then PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init -)" fi
Then I just re-source my bash profile, or restart the terminal, and then check if I get a response from:
I can install a python version:
pyenv install 2.7.6 3.3.5
Then, just rebuild the shims, by using rehash:
pyenv rehash
pyenv versions
And by using the versions, you can see the python versions you have installed including the system python if you had python installed previously. By default, I am still using the system python, but I can switch to the 3.3.5 version by doing:
And just do everything I normally do, as if I installed 3.3.5 as the system python.