windows 无法加载 Subversion python 绑定

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1657918/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:22:22  来源:igfitidea点击:

Subversion python bindings could not be loaded

pythonwindowssvnmercurial

提问by Paul

This is a but of a part 2 in trying to convert an SVN repository to a Mercurial one

这是尝试将 SVN 存储库转换为 Mercurial 存储库的第 2 部分的一部分

command is:

命令是:

hg convert file://c:/svnrepository

but, the output I get is:

但是,我得到的输出是:

assuming destination svnrepository-hg
initializing destination svnrepository-hg repository
file://c:/svnrepository does not look like a CVS checkout
file://c:/svnrepository does not look like a Git repo
Subversion python bindings could not be loaded
file://c:/svnrepository is not a local Mercurial repo
file://c:/svnrepository does not look like a darcs repo
file://c:/svnrepository does not look like a monotone repo
file://c:/svnrepository does not look like a GNU Arch repo
file://c:/svnrepository does not look like a Bazaar repo
file://c:/svnrepository does not look like a P4 repo
abort: file://c:/svnrepository: missing or unsupported repository

The line I'm interested in is:

我感兴趣的线路是:

Subversion python bindings could not be loaded

I have installed python 2.5, and I have installed the python subversion bindings from the subversion website. But still getting this error

我已经安装了 python 2.5,并且我已经从 subversion 网站安装了 python subversion 绑定。但仍然收到此错误

采纳答案by Alex Martelli

The problem's explained hereat heading "Converting from Subversion":

这个问题的解释这里的标题是“从Subversion转换”:

Subversion's Python bindings are a prerequisite. The bindings (generated with SWIG) are installed separately on Windows, and can be found on http://subversion.tigris.org/. Note that you can't do this with the Win32 Mercurial binaries -- there's no way to install the Subversion bindings into its built-in Python library. So you'll need to use a Mercurial installed on top of a stand-alone Python, and you may also need to do something like "set HG=python c:\Python25\Scripts\hg" to override the default Win32 binaries if you have those installed also. For Mac OS X, the easiest way is to install the CollabNet Subversion build, and then copy the content of /opt/subversion/lib/svn-python to the site-package directory of the python installation.

Subversion 的 Python 绑定是先决条件。绑定(使用 SWIG 生成)单独安装在 Windows 上,可以在http://subversion.tigris.org/上找到 。请注意,您无法使用 Win32 Mercurial 二进制文件执行此操作——无法将 Subversion 绑定安装到其内置 Python 库中。因此,您需要使用安装在独立 Python 之上的 Mercurial,并且您可能还需要执行诸如“set HG=python c:\Python25\Scripts\hg”之类的操作来覆盖默认的 Win32 二进制文件,如果您也安装了那些。对于 Mac OS X,最简单的方法是安装 CollabNet Subversion build,然后将 /opt/subversion/lib/svn-python 的内容复制到 python 安装的 site-package 目录中。

Unfortunately hg + svn + win doesn't apparently get any easier with hgsubversion, at least judging from this postand this discussionthereof (I have no Windows installed to try and help out, sigh).

不幸的是 hg + svn + win 显然并没有让hgsubversion变得更容易,至少从这篇文章这个讨论来看(我没有安装 Windows 来尝试帮助,叹气)。

回答by Jerph

I just wanted to bring the actual solution out of the comments to Alex Martelli's answer:

我只是想从对 Alex Martelli 的回答的评论中提出实际的解决方案:

According to https://www.mercurial-scm.org/pipermail/mercurial/2009-May/026015.htmlthe subversion bindings are included in tortoisehg. So you just need to enable the convert extension in tortoisehg. – tonfa

Ah ha! Another step forward. I changed my path to point at hg in TortoiseHG instead of Mercurial and this got over that hurdle. Now it just doesn't think the repository is an SVN one, ahh! – Paul

根据https://www.mercurial-scm.org/pipermail/mercurial/2009-May/026015.html,颠覆绑定包含在 tortoisehg 中。所以你只需要在 tortoisehg 中启用转换扩展。– 通法

啊哈!又向前迈进了一步。我改变了路径,指向 TortoiseHG 中的 hg 而不是 Mercurial,这克服了那个障碍。现在它只是不认为存储库是 SVN 存储库,啊!– 保罗

This worked for me as well.

这对我也有用。

If you're currently using the standard command line version of HG on Windows, the specific steps are:

如果您目前在 Windows 上使用标准命令行版本的 HG,则具体步骤是:

  • Install TortoiseHG
  • Right click a file / TortoiseHG / Global Settings... / Extensions / {Check "convert"}
  • Make sure TortoiseHG is the path for your hg command:
    • WinKey+Pause / Advanced / Environment Variables / System Variables / Path
    • REMOVE C:\Program Files\Mercurial from the path
    • Make sure C:\Program Files\TortoiseHG is there
  • 安装 TortoiseHG
  • 右键单击文件 / TortoiseHG / 全局设置... / 扩展 / {检查“转换”}
  • 确保 TortoiseHG 是您的 hg 命令的路径:
    • WinKey+暂停/高级/环境变量/系统变量/路径
    • 从路径中删除 C:\Program Files\Mercurial
    • 确保 C:\Program Files\TortoiseHG 在那里

回答by ashishsony

sudo apt-get install python-subversion

did the trick for me on Ubuntu.

在 Ubuntu 上帮我解决了这个问题。