Nathan Grigg

Virtualenv makes upgrading simple

Apple has a history of erasing Python’s site-packages folder during operating system upgrades, leaving users without their third-party Python modules and breaking scripts everywhere. Although I’ve heard that some reports of the upgrade to 10.9 leaving things alone, mine were wiped once again.

Last year when this happened, I vowed to switch everything over to virtualenv, which allows you to install packages in a custom location. With this setup, getting things working again was as easy as recreating my local.pth file:

sudo vim /Library/Python/2.7/site-packages/local.pth

with a single line containing the path to my virtualenv site packages: