With multiple Python installations, how does MacPorts know which one to install MySQLdb?

I just updated Python 2.5 by default on Leopard to 2.6 through the installer on www.python.org. After that, MySQLdb, which I installed, was no longer found. So I tried reinstalling it with port install py-mysql , and it succeeded, but MySQLdb was still not import . So, I tried python install python26 with python_select python26 and it succeeded, but it doesn't seem to take precedence over installing python.org:

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

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

My environment path : /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?

0
python mysql macos
source share
2 answers

MacPorts python ports usually follow the pattern: if the port name starts only with py- , it is configured to install in MacPorts python2.4. Similarly py25- requires python2.5. For MacPorts python2.6 you want this port :

 sudo port install py26-mysql 
+2
source share

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

+1
source share

All Articles