未定义符号:尝试安装 psycopg2 时 PyUnicodeUCS2_Decode

发布于 2024-08-28 04:45:49 字数 661 浏览 10 评论 0原文

我尝试在 ubuntu 9.10 64 位上安装 psycopg2 时遇到错误。

错误是:

>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "psycopg2/__init__.py", line 69, in <module>
    from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: psycopg2/_psycopg.so: undefined symbol: PyUnicodeUCS2_Decode

我尝试从 http://initd.org/pub/software/ 下载软件包psycopg/ 并安装它。我也尝试过使用 easy_install 。

安装过程中没有错误。

这很奇怪,因为我的 python (2.6.2) 是用 UCS4 编译的,所以安装应该可以正常工作。

任何帮助将不胜感激。

干杯

I'm getting an error whilst trying to install psycopg2 on ubuntu 9.10 64 bit.

The error is:

>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "psycopg2/__init__.py", line 69, in <module>
    from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: psycopg2/_psycopg.so: undefined symbol: PyUnicodeUCS2_Decode

I've tried downloading the package from http://initd.org/pub/software/psycopg/ and installing it. I've tried by using easy_install too.

No error during the installation.

It's quite weird as my python (2.6.2) has been compiled with UCS4 and so the installation should just work without problems.

Any help would be appreciated.

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

抚你发端 2024-09-04 04:45:49

修好了。

我必须使用 --enable-unicode=ucs4 重新编译 python。

仍然不清楚为什么 ubuntu 上的默认版本使用 ucs4。

fixed it.

I had to recompile python with --enable-unicode=ucs4.

Still not clear why as the default version on ubuntu uses ucs4.

妖妓 2024-09-04 04:45:49

就像你说的,你的Python已经构建成UCS4了。但是您尝试安装的 psycopg2 是针对 Python 构建的 UCS2 构建的。找到一个或针对 UCS4 构建一个。

Like you say, your Python has been built UCS4. But the psycopg2 you're trying to install has been built against a Python built UCS2. Find one or build one against UCS4.

哽咽笑 2024-09-04 04:45:49

bx-python 导入 bx.intervals 时,我遇到了同样的错误:

undefined symbol: PyUnicodeUCS2_Decode

但是,我使用的 python 版本已经用 ucs4 编译。显然,bx-python 是针对使用 ucs2 编译的 python 版本构建的。所以我必须按照OP描述的相反方式重新编译python:./configure --enable-unicode=ucs2

I had the same error when importing bx.intervals from bx-python:

undefined symbol: PyUnicodeUCS2_Decode

However, the python version I was using was already compiled with ucs4. Apparently, bx-python was built against a python version that was compiled with ucs2. So I had to recompile python in the opposite way described by the OP: ./configure --enable-unicode=ucs2.

为你拒绝所有暧昧 2024-09-04 04:45:49

就我而言,使用 bash shell 没有任何问题,而使用 csh 则面临这个问题。实现了安装了多个版本的python。 /usr/local/bin 中的默认值有效,而 /bin 中的默认值则显示了该问题。重点是,在您认为需要使用管理员帮助重新编译之前,请检查您是否安装了任何替代版本的 python。

In my case, using bash shell I had no issue and with csh faced this issue. Realized have multiple version of python installed. one defaulting in /usr/local/bin worked vs one in /bin exhibited the issue. Point being before you think you need to recompile with admin help check if you have any alternate version of python installed.

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