为什么我无法在 Python 2.4 virtualenv 中导入此 Zope 组件?

发布于 2024-07-27 16:56:18 字数 1083 浏览 3 评论 0原文

我正在尝试使用 plone.app.blob 和 repoze 安装 Plone 3.3rc4,但到目前为止我尝试过的任何方法都不起作用。 我尝试将 repoze.zope2、Plone 和 plone.app.blob 安装到 virtualenv 中。 我在 virtualenv 中有 此版本的 DocumentTemplate site-packages 目录,我正在尝试让它在 RHEL5 中运行。

由于某种原因,当我尝试在这种环境中运行pasterserveetc/zope2.ini时,Python会给出消息ImportError:没有名为DT_Util的模块? 该目录下有DT_Util.py__init__.py也在,它所依赖的C模块也在。 我怀疑导入 C 扩展时存在一些循环依赖或失败。 当然这个模块可以在正常的 Zope 安装中工作......

>>> import DocumentTemplate
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "DocumentTemplate/__init__.py", line 21, in ?
  File ".../lib/python2.4/site-packages/DocumentTemplate/DocumentTemplate.py", line 112, in ?
    from DT_String import String, File
  File ".../lib/python2.4/site-packages/DocumentTemplate/DT_String.py", line 19, in ?
    from DocumentTemplate.DT_Util import ParseError, InstanceDict
ImportError: No module named DT_Util

I'm trying to install Plone 3.3rc4 with plone.app.blob and repoze but nothing I've tried has worked so far. For one attempt I've pip-installed repoze.zope2, Plone, and plone.app.blob into a virtualenv. I have this version of DocumentTemplate in the virtualenv's site-packages directory and I'm trying to get it running in RHEL5.

For some reason when I try to run paster serve etc/zope2.ini in this environment way Python gives the message ImportError: No module named DT_Util? DT_Util.py exists in the directory, __init__.py is there too, and the C module it depends on is there. I suspect there's some circular dependency or failure when importing the C extension. Of course this module would work in a normal Zope install...

>>> import DocumentTemplate
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "DocumentTemplate/__init__.py", line 21, in ?
  File ".../lib/python2.4/site-packages/DocumentTemplate/DocumentTemplate.py", line 112, in ?
    from DT_String import String, File
  File ".../lib/python2.4/site-packages/DocumentTemplate/DT_String.py", line 19, in ?
    from DocumentTemplate.DT_Util import ParseError, InstanceDict
ImportError: No module named DT_Util

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

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

发布评论

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

评论(1

影子是时光的心 2024-08-03 16:56:18

我必须说我怀疑 Zope 的 DocumentTemplate 能否独立工作。 不过,欢迎您尝试。 :-)

请注意 DT_Util 导入 C 扩展< /a>:

from DocumentTemplate.cDocumentTemplate import InstanceDict, TemplateDict
from DocumentTemplate.cDocumentTemplate import render_blocks, safe_callable
from DocumentTemplate.cDocumentTemplate import join_unicode

您需要确保它们已编译。 我的猜测是,导入 cDocumentTemplate 模块失败,因此导入 DT_Util 失败。

I must say I doubt DocumentTemplate from Zope will work standalone. You are welcome to try though. :-)

Note that DT_Util imports C extensions:

from DocumentTemplate.cDocumentTemplate import InstanceDict, TemplateDict
from DocumentTemplate.cDocumentTemplate import render_blocks, safe_callable
from DocumentTemplate.cDocumentTemplate import join_unicode

You'll need to make sure those are compiled. My guess is that importing the cDocumentTemplate module fails and thus the import of DT_Util fails.

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