如何更改 Mac OSX 上 plpython 使用的 Python 版本?

发布于 2024-11-05 15:35:34 字数 639 浏览 0 评论 0原文

我已使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

赴月观长安 2024-11-12 15:35:34

您需要从源头重建。在二进制发行版中无法更改它。

当您运行 configure 时,将环境变量 PYTHON 设置为您要使用的 python 二进制文件的完整路径,例如,

./configure --other-stuff ... PYTHON=/usr/bin/python2.6

您可以尝试我猜是为了让 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 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.

泅人 2024-11-12 15:35:34

我应该将其作为对 Peter Eisentraut 的答案的评论发布,但我一直按 Enter 键,然后在评论完成之前意外发布;另外,我想添加一些链接和其他内容:

我最终完全按照彼得的建议做了 - 从源代码和 EnterpriseDB 论坛 中发布此问题。由于某种原因,我的论坛帖子出现在一些我以前从未听说过的用户名下,我什至可以阅读该用户的所有帖子。也许他/她在我之前登录,对我来说,他们的论坛软件看起来像是一个相当大的错误:-(

无论如何,构建 plpython 二进制文件只涉及 下载最新的 PostgreSQL 源代码,解压并将一些参数传递给 configure 作为 记录

configure --with-python PYTHON=/usr/bin/python2.6

然后,运行 make 进行构建。尽管事实上默认的 Python 版本我的系统是 2.6,我明确地将其作为参数传递,configure 打印此消息,

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

但构建的二进制文件无论如何使用 Python 2.7 安装我什至不记得我已经安装了:

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)

这对我来说已经足够好了,我需要的是更新的版本2.5 仍然很奇怪。

现有的 plpython 二进制文件(使用 Python 2.5 的二进制文件)位于 /Library/PostgreSQL/9.0/lib/postgresql/plpython2.so 中,带有符号链接 < code>plpython.so 到同一文件夹中。为了安全起见,我选择保留原始内容并重新符号链接而不是删除:

sudo mv plpython2.so plpython25.so
sudo cp <postgres build dir>/src/pl/plpython/plpython2.so plpython27.so
sudo ln plpython27.so plpython2.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:

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文