I have installed PostgreSQL 9.0.4 on Mac OSX 10.6 using the installer from EnterpriseDB and noticed that stored procedures implemented in plpython use python 2.5. A look into the plpython library seems to confirm that (otool sort of does on the mac what ldd does on linux):
host:~ user$ otool -L /Library/PostgreSQL/9.0/lib/postgresql/plpython2.so
/Library/PostgreSQL/9.0/lib/postgresql/plpython2.so:
/System/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.1)
/usr/lib/libSystem.B.dylib (compatibi开发者_开发技巧lity version 1.0.0, current version 111.1.4)
how can I change that from Python 2.5 to Python 2.6 ?
kind regards,
ssc
You need to rebuild from source. There is no way to change it in a binary distribution.
When you run configure
, set the environment variable PYTHON
to the complete path of the python
binary that you want to use, e.g.,
./configure --other-stuff ... PYTHON=/usr/bin/python2.6
You could try to bug the EnterpriseDB people to update their build routines, I guess. Not sure by what criteria they choose the Python version. Alternatively, perhaps install from MacPorts.
I should post this as a comment to Peter Eisentraut's answer, but I keep hitting enter and then accidentally post before the comment is finished; also, I want to add some links and other stuff:
I ended up doing exactly what Peter recommended - both rebuilding from source and posting this issue in the EnterpriseDB forum. For some reason, my forum post showed up under some username I've never heard before, I could even read all posts of that user. Maybe he/she was logged in before me, looks like a pretty massive bug in their forum software to me :-(
Anyway, building the plpython binary involves nothing more than download the latest PostgreSQL source code, unpack it and pass some parameters to configure
as documented:
configure --with-python PYTHON=/usr/bin/python2.6
Then, run make
to build. Despite the fact that the default Python version on my system is 2.6 and I explicitely pass that as parameter, configure prints this message
checking for python... /usr/bin/python2.6
checking for Python distutils module... yes
checking Python configuration directory... /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config
checking how to link an embedded Python application... -L/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config -lpython2.6 -ldl
checking whether Python is compiled with thread support... yes
but the built binary anyway uses a Python 2.7 installation I didn't even remember I had installed:
otool -L <postgres build dir>/src/pl/plpython/plpython2.so
<postgres build dir>/src/pl/plpython/plpython2.so:
/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.10)
That's good enough for me, all I need is a more recent version that 2.5. Still weird.
The existing plpython binary (the one using Python 2.5) resides in the EnterpriseDB default installation directory at /Library/PostgreSQL/9.0/lib/postgresql/plpython2.so
with a symlink plpython.so
to it in the same folder. I choose to keep the original just to be on the safe side and re-symlink instead of deleting:
sudo mv plpython2.so plpython25.so
sudo cp <postgres build dir>/src/pl/plpython/plpython2.so plpython27.so
sudo ln plpython27.so plpython2.so
hmmm, maybe this should go into the wiki...
精彩评论