在 Windows/Python 2.7 上使用 mailer.py 时没有名为 _core 的模块
我正在尝试配置和运行 SVN post-commit hook 发送邮件。我已经下载了 mailer.py 类,安装了 Python 2.7 和 svn-win32 绑定。机器是Windows-7 64位,Python是32位。现在mailer.py以错误结束,这是由导入问题引起的。
当我在 python 控制台中输入“import svn.core”时,出现以下错误:
>>> import svn.core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\tools\Python27\lib\site-packages\svn\core.py", line 19, in <module>
from libsvn.core import *
File "c:\tools\Python27\lib\site-packages\libsvn\core.py", line 5, in <module>
import _core
ImportError: No module named _core
而在目录 site-packages/libsvn 中有如下文件: _core.dll
我已经安装了其他绑定 pysvn,该绑定已正确安装,但到目前为止正如我所注意到的,它是完全不同的 API,所以我不能将其用于 python.py
有人遇到类似的问题并且知道如何处理它吗?
I'm trying to configure and run SVN post-commit hook sending mails. I've downloaded class mailer.py, installed Python 2.7 and svn-win32 bindings for svn. The machine is Windows-7 64 bit, the Python is 32 bit. Now the mailer.py ends with error, which is caused by import problem.
When I in python console type "import svn.core" I have following error:
>>> import svn.core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\tools\Python27\lib\site-packages\svn\core.py", line 19, in <module>
from libsvn.core import *
File "c:\tools\Python27\lib\site-packages\libsvn\core.py", line 5, in <module>
import _core
ImportError: No module named _core
while in directory site-packages/libsvn are files such as: _core.dll
I've installed other bindings, pysvn, that was installed correctly, but as far as I've noticed, it's the totally other API so I can't use that for python.py
Does someone had similar problem and knows how to deal with it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Python 绑定需要加载本机 Subversion 库 (DLL)。如果您的 Python 是 32 位,那么您将需要 PATH 上的本机 Subversion 库的 32 位版本。
The Python bindings need to load the native Subversion libraries (DLL's). If your Python is 32-bit then you would need 32-bit versions of the native Subversion libraries on PATH.
我有这样的问题。问题是 python 无法导入这个库(svn.core 和其他库)。
我只是做:
导入系统
sys.path.append("C:\csvn\lib\svn-python").
我的文件 core.pyc 位于 C:\csvn\lib\svn-python\svn 中。希望它对某人有帮助。这种行为对我来说很奇怪,因为 svn-python 目录中没有“init.py”或“init.pyc”文件。但它有效。
I have problem like this. Trouble was that python just can not import this library (svn.core and other).
I just make:
import sys
sys.path.append("C:\csvn\lib\svn-python").
My file core.pyc was in C:\csvn\lib\svn-python\svn. Hope it helps somebody. Such behacior for me is strange because there is no "init.py" or "init.pyc" file in svn-python directory. But it works.