如何更改 Mac OSX 上 plpython 使用的 Python 版本?
我已使用 EnterpriseDB 中的安装程序在 Mac OSX 10.6 上安装了 PostgreSQL 9.0.4注意到 plpython 中实现的存储过程使用 python 2.5。对 plpython 库的研究似乎证实了这一点(otool 在 mac 上的作用类似于 ldd 在 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(兼容版本2.5.0,当前版本2.5.1)
/usr/lib/libSystem.B.dylib(兼容性版本 1.0.0,当前版本 111.1.4)
如何将其从 Python 2.5 更改为 Python 2.6 ?
亲切的问候,
SSC
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 (compatibility 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要从源头重建。在二进制发行版中无法更改它。
当您运行
configure
时,将环境变量PYTHON
设置为您要使用的python
二进制文件的完整路径,例如,您可以尝试我猜是为了让 EnterpriseDB 人员更新他们的构建例程。不确定他们选择 Python 版本的标准是什么。或者,也可以从 MacPorts 安装。
You need to rebuild from source. There is no way to change it in a binary distribution.
When you run
configure
, set the environment variablePYTHON
to the complete path of thepython
binary that you want to use, e.g.,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.
我应该将其作为对 Peter Eisentraut 的答案的评论发布,但我一直按 Enter 键,然后在评论完成之前意外发布;另外,我想添加一些链接和其他内容:
我最终完全按照彼得的建议做了 - 从源代码和 在 EnterpriseDB 论坛 中发布此问题。由于某种原因,我的论坛帖子出现在一些我以前从未听说过的用户名下,我什至可以阅读该用户的所有帖子。也许他/她在我之前登录,对我来说,他们的论坛软件看起来像是一个相当大的错误:-(
无论如何,构建 plpython 二进制文件只涉及 下载最新的 PostgreSQL 源代码,解压并将一些参数传递给
configure
作为 记录:然后,运行
make
进行构建。尽管事实上默认的 Python 版本我的系统是 2.6,我明确地将其作为参数传递,configure 打印此消息,但构建的二进制文件无论如何使用 Python 2.7 安装我什至不记得我已经安装了:
这对我来说已经足够好了,我需要的是更新的版本2.5 仍然很奇怪。
现有的 plpython 二进制文件(使用 Python 2.5 的二进制文件)位于
/Library/PostgreSQL/9.0/lib/postgresql/plpython2.so
中,带有符号链接 < code>plpython.so 到同一文件夹中。为了安全起见,我选择保留原始内容并重新符号链接而不是删除:嗯,也许这应该进入维基百科......
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: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 messagebut the built binary anyway uses a Python 2.7 installation I didn't even remember I had installed:
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 symlinkplpython.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:hmmm, maybe this should go into the wiki...