Skip to content.

plope

Personal tools
You are here: Home » Members » chrism's Home » Leopard Python
 
 

Leopard Python

Lots of people express the sentiment that Apple's Leopard ships with a "nice Python setup". I use Leopard, and I'm sure it does come with a nice system Python, but I don't use it.

I consistently see people on blogs and various other places saying that Apple's Leopard ships with a "nice Python setup." But I have to wonder: why would you care? It ships with Twisted... I don't use Twisted, but that's nice for people who do I suppose. But even if this is a feature for you, installing a brand-new Python with Twisted is at most a fifteen-minute job, at least as long as you have XCode Tools installed.

And don't you usually want to install more software into the Python you use every day? If you install a new interpreter into a place you have write permissions, you don't need to sudo to easy_install packages. It creeps me out to need to do that on any platform, because I know I'm "drawing outside the lines" of whatever native packaging system is on the platform. And given that the Mac doesn't have such an animal (except for Fink and DarwinPorts, but I think they ship their own Pythons), so I can't see what "owns" or "depends" on the system Python files, it would make me even more nervous to do so.

I (sadly) have tens of Python interpreter sandboxes installed on my MacBook (wget <python URL>; ./configure --prefix=/foo/bar; make; make install).. I used to tend to build one for each project I'm working but now I use virtualenv for the same purpose, which essentially gives me the same thing, just much faster. I never install anything into the Apple-shipped Python's site-packages directory, because I have no clue what Mac subsystems might depend on it (if any) and I don't want to foul it up. I put a "python" symlink in my $HOME/bin dir that points and whatever the "main instance" of python-du-jour is I'm using so I can just do "python whatever.py" and have it run under my custom-built Python.

In any case, if it makes you nervous to install packages (at least not using the native package manager) into a "system" Python, and you don't have the excuse that you're running on Windows, you might want to try building your own. In any case, even if you do run on Windows, and even if you don't want to compile your own Python, you should definitely check out virtualenv.

Created by chrism
Last modified 2007-11-21 05:12 PM