A Lion Ate My Python

After upgrading to Lion I quickly discovered that many of my custom macros that depend on Python were broken. A busy schedule meant that I put off researching the issue. Fortunately DrDrang’s recent post shed some light on the issue.

It appears that Lion uses a newer version of Python (2.7) and also has a bit more restrictions when installing packages. If you want to get your python customizations back you’ll need to perform some maintenance.

XCode Update

Several blog posts (including DrDrang’s) recommend reinstalling Xcode 4 after upgrading to Lion. I figured it couldn’t hurt. Along the way, I also uninstalled Xcode 3.

Another Python Package Installer

In my research, I stumbled across a Python installer package to replace the easy_install mechanism. Distribute seems to be an actively developed fork of the setuputil. It’s worth taking a second to install.

 

[cc_bash]curl -O http://python-distribute.org/distribute_setup.py sudo python distribute_setup.py sudo easy_install pip[/cc_bash]

The Rest

For my particular needs, I chose to install a few packages to start with on Lion. Specifically, lxml, python-pinboard and parsedatetime

 

[cc_bash]sudo pip install lxml sudo pip install python-pinboard sudo pip install parsedatetime[/cc_bash]