tags:

views:

292

answers:

2

I just upgraded the default Python 2.5 on Leopard to 2.6 via the installer on www.python.org. Upon doing so, the MySQLdb I had installed was no longer found. So I tried reinstalling it via port install py-mysql, and it succeeded, but MySQLdb was still not importable. So then I tried to python install python26 with python_select python26 and it succeeded, but it doesn't appear that it is getting precedence over the python.org install:

$ which python
/Library/Frameworks/Python.framework/Versions/2.6/bin/python

When I would expect it to be something like /opt/local/bin/python

My path environment is: /Library/Frameworks/Python.framework/Versions/2.6/bin:/usr/local/mysql/bin/:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/mysql/bin:/Users/bsr/bin

Anyway, when I try port install py-mysql but how does it know where to install the Python MySQL library?

+1  A: 

The MacPorts python ports generally follow a pattern: if the port name starts with just py-, it is configured to install into MacPorts python2.4. Likewise py25- requires python2.5. For the MacPorts python2.6, you want this port:

sudo port install py26-mysql
Ned Deily
A: 

You also need python_select (or is it select_python?) to change the default python used.

someone