This will be a short post but I just wanted to make sure to write up a simple post on how exactly pythonbrew works and how much time and effort it can save you when managing different python installs on any given OS.

So pythonbrew is quite simple to install, you can start by having a look at the github project here, but installing it is as easy as:

curl -kL http://xrl.us/pythonbrewinstall | bash

and then adding the following to your bashrc:

[[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc

With this you now have pythonbrew ready to go and you can check what are the currently available version of python you can install with:

>pythonbrew list -k # Pythons Python-1.5.2 Python-1.6.1 Python-2.0.1 Python-2.1.3 Python-2.2.3 Python-2.3.7 Python-2.4.6 Python-2.5.6 Python-2.6.8 Python-2.7.3 Python-3.0.1 Python-3.1.4 Python-3.2.3 Python-3.3.0

Now isn’t that impressive that you can actually install a python version from 1.5.2 to the very latest bleeding 3.3.0 version ? So installing any of those versions is as easy as:

> pythonbrew install Python-2.4.6 Downloading Python-2.4.6.tgz as /home/rlgomes/.pythonbrew/dists/Python-2.4.6.tgz ######################################################################## 100.0% Extracting Python-2.4.6.tgz into /home/rlgomes/.pythonbrew/build/Python-2.4.6 This could take a while. You can run the following command on another shell to track the status: tail -f "/home/rlgomes/.pythonbrew/log/build.log" Patching Python-2.4.6 Installing Python-2.4.6 into /home/rlgomes/.pythonbrew/pythons/Python-2.4.6 pythonbrew list Downloading distribute_setup.py as /home/rlgomes/.pythonbrew/dists/distribute_setup.py ######################################################################## 100.0% Installing distribute into /home/rlgomes/.pythonbrew/pythons/Python-2.4.6 Installing pip into /home/rlgomes/.pythonbrew/pythons/Python-2.4.6 Installed Python-2.4.6 successfully. Run the following command to switch to Python-2.4.6. pythonbrew switch 2.4.6

Checking what versions are currently available is also very easy:

> pythonbrew list # pythonbrew pythons Python-2.4.6 Python-2.7.2 Python-2.7.3 (\*) Python-3.2 Python-3.3.0

As you can see the above is stating that version 2.7.3 is currently in use and for you to switch the current terminal session over to another version you can do this like so:

> pythonbrew use 2.4.6 Using `Python-2.4.6

By this point you realize this is just to darn easy and makes using multiple python versions on the same host quite easy. The other nice thing is that pythonbrew already has virtual environments built in and you can see the rest of those commands right in the README provided in github.

You should really start using pythonbrew from now on as it makes installing and changing python versions quite easy.


blog comments powered by Disqus