tags:

views:

533

answers:

5

The default Python install on OS X 10.5 is 2.5.1 with a fat 32 bit (Intel and PPC) client. I want to setup apache and mysql to run django. In the past I have run apache and mysql to match this install in 32 bit mode (even stripping out the 64 bit stuff from apache to make it work).

I want to upgrade Python to 64 bit. I am completely comfortable with compiling it from source with one caveat. How to I match the way that the default install is laid out? Especially with regards to site-packages being in /Library/Python/2.5/ and not the one in buried at the top of the framework once I compile it.

+1  A: 

Not sure I entirely understand your question, but can't you simply build and install a 64 bit version and then create symbolic links so that /Library/Python/2.5 and below point to your freshly built version of python?

Clokey
A: 

Essentially, yes. I was not sure you could do it like that (current version does not do it like that). When using the python install script, however, there is no option (that I can find) to specify where to put directories and files (eg --prefix). I was hoping to match the current layout of python related files so as to avoid 'polluting' my machine with redundant files.

Hyposaurus
+1  A: 

Personally, I wouldn't worry about it until you see a problem. Messing with the default python install on a *Nix system can cause more trouble than it's worth. I can say from personal experience that you never truly understand what python has done for the nix world until you have a problem with it.

You can also add a second python installation, but that also causes more problems than it's worth IMO.

So I suppose the best question to start out with would be why exactly do you want to use the 64 bit version of python?

Jason Baker
A: 

The short answer is because I can. The long answer, expanding on what the OP said, is to be more compatible with apache and mysql/postgresql. They are all 64bit (apache is a fat binary with ppc, ppc64 x86 and x86 and x86_64, the others just straight 64bit). Mysqldb and mod_python wont compile unless they are all running the same architecture. Yes I could run them all in 32bit (and have in the past) but this is much more work then compiling one program.

EDIT: You pretty much convinced though to just let the installer do its thing and update the PATH to reflect this.

Hyposaurus
+1  A: 

Hyposaurus,

It is possible to have multiple versions of Python installed simultaneously. Installing two versions in parallel solves your problem and helps avoid the problems laid out by Jason Baker above.

The easiest way, and the way I recommend, is to use MacPorts, which will install all its software separately. By default, for example, everything is installed in /opt/local

Another method is to simply download the source and compile with a specified prefix. Note that this method doesn't modify your PATH environment variable, so you'll need to do that yourself if you want to avoid typing the fully qualified path to the python executable each time

./configure --prefix=/usr/local/python64
make
sudo make install

Then you can simply point your Apache install at the new version using mod_python's PythonInterpreter directive

John Douthat