Mercurial 错误 *** 无法导入扩展 hggit:没有名为 hggit 的模块

发布于 2024-10-19 10:40:50 字数 413 浏览 3 评论 0原文

我在 Mac 上安装了 Mercurial,效果非常好。对我来说,它比 Git 更容易掌握,所以我想用它来管理 git 存储库。因此,我按照以下说明安装了 hg-git:

http://hg-git.github.com/

但是,每次我发出 hg 命令时,它都会返回此错误消息:

  Mercurial error *** failed to import extension hggit: No module named hggit 

值得注意的是,我使用的是 Mac,而不是 Gnu/Linux 或 MS-Windows。

有谁知道如何解决这个问题?

I installed Mercurial on my Mac, and it's wonderful. For me it's easier to grasp than Git so I wanted to use it to manage git-repositories. Therefore I installed hg-git with the following instructions:

http://hg-git.github.com/

However, each time I issue a hg command it returns this error message:

  Mercurial error *** failed to import extension hggit: No module named hggit 

It might be important to note that I'm on a Mac not Gnu/Linux or MS-Windows.

Does any one know how to resolve this?

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

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

发布评论

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

评论(7

三生一梦 2024-10-26 10:40:50

对于安装“mercurial-git”软件包以在 12.04 上获取 hggit 模块的 ubuntu 用户请注意,一些明亮的 Spark 随机将该模块重命名为“git”,因此您需要将 ~/.hgrc 更改为如下所示

[extensions]
hgext.bookmarks =
git =

Note for ubuntu users who install the "mercurial-git" package to get the hggit module on 12.04 some bright spark randomly renamed the module to just "git" so you need to change your ~/.hgrc to look something like

[extensions]
hgext.bookmarks =
git =
月隐月明月朦胧 2024-10-26 10:40:50

使用以下命令安装 hg-git 后:

easy_install hg-git

以下命令有效吗?

python -c "import hggit"

这对您意味着什么:

head -n1 `which hg`

后一个命令的目的是验证 Python hg 是否在安装了 hggit 的情况下运行。就我而言,它显示“#!/usr/bin/python”,这是我的标准 python 命令。

这句话说什么:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.a­pp/Contents/MacOS/Python -c "import hggit"

After installing hg-git with the following command:

easy_install hg-git

Does the following work?

python -c "import hggit"

What does this say for you:

head -n1 `which hg`

The point of the latter command is to verify that the Python hg runs under has hggit installed. In my case it says '#!/usr/bin/python', which is my standard python command.

What does this say:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.a­pp/Contents/MacOS/Python -c "import hggit"
蓝眼睛不忧郁 2024-10-26 10:40:50

我通过以下方式安装了Python和TortoiseHg:

brew cask install python
brew cask install tortoisehg

安装后

sudo easy_install hg-git

我遇到了类似的问题(TortoiseHg:无法导入扩展hggit:没有名为hggit的模块等等...),最后找到了我的TortoiseHg的解决方案mac(首先通过sudo pip uninstall hg-git卸载最后一个hg-git):

sudo pip install mercurial
sudo pip install hg-git

使用pip安装并向所有重要分支添加书签后,例如

hg bookmark -r default master
hg bookmark -r branchename bookmarkname

......我可以将 HG 存储库推送到 Git:

hg push git+ssh://[email protected]/reponame.git --traceback

注意:使用 ssh! - 减少大型存储库的问题

注释 2:--traceback 告诉您问题

I installed Python and TortoiseHg by:

brew cask install python
brew cask install tortoisehg

After following installation

sudo easy_install hg-git

I experienced similar problems (TortoiseHg: failed to import extension hggit: No module named hggit and so on...) and finally found a solution for my TortoiseHg on mac (first uninstall last hg-git by sudo pip uninstall hg-git):

sudo pip install mercurial
sudo pip install hg-git

After installation with pip and adding bookmarks to all important branches, e. g. ...

hg bookmark -r default master
hg bookmark -r branchename bookmarkname

... I could push HG repository to Git:

hg push git+ssh://[email protected]/reponame.git --traceback

Note: use ssh! - causes fewer problems with large repositories

Note 2: --traceback tells you about problems

烟酉 2024-10-26 10:40:50

即使在下载了最新的 Tortoisehg 并确保安装了 hggit 插件以及我的 .ini 和 .ini 后,我也遇到了这个错误。 hgrc 文件具有启用 hggit 的正确条目。

事实证明我的问题是我的道路上同时有水星和乌龟。因此,当我运行任何 hg 命令时,它使用的是 Mercurial 文件夹中的 hg.exe,而不是 torsoisehg 目录中的 hg.exe。

这是有道理的,但我的 Mercurial 安装没有插件。我的修复方法是从我的路径中删除 Mercurial,以便 hg 命令通过 tortoisehg 目录,因为它已完全捆绑 hg。但请注意,推荐的选项可能是将 Mercurual 升级到具有所需插件的版本,但这对我有用。我尝试将 Mercurial 中的library.zip 替换为tortoisehg 中的library.zip,这有效,但正如人们想象的那样,它导致了其他错误。

I got this error as well even after downloading the latest Tortoisehg and making sure the hggit plugin was installed as well as my .ini & hgrc files had the right entry to enable hggit.

Turns out my problem was that I had both mercurial and tortoisehg in my path. So when I ran any hg commands, it was using the hg.exe in mercurial folder as opposed to the hg.exe in the torsoisehg directory.

This makes sense but my mercurial installation did not have the plug ins. My fix was to remove mercurial from my path so hg commands go through the tortoisehg directory since it has hg completely bundled. Note however, the recommended option might be to upgrade mercurual to a version that has the plugins that one needs but this is what worked for me. I tried replacing the library.zip in mercurial with the one in tortoisehg and this worked but it led to other errors as one would imagine.

一人独醉 2024-10-26 10:40:50

我遇到了与通过 brew install Mercurial 看到的相同问题,一些软件包丢失了。

测试是否有任何软件包丢失,例如: python -c "import hggit"

我的修复:卸载所有软件包:

brew uninstall Mercurial

install with pip例如:

  • sudo easy_install pip (如果您没有 pip

  • sudo pip install Mercurial

  • sudo pip安装hg-git

然后

hg 书签 -r 默认母版

I had the same problem as I saw via brew install mercurial some packages are missing.

Do a test if any package missed like: python -c "import hggit"

My fix: Uninstall all packages:

brew uninstall mercurial

install with pip like:

  • sudo easy_install pip ( if you don't have pip )

  • sudo pip install mercurial and

  • sudo pip install hg-git

then

hg bookmark -r default master

趁年轻赶紧闹 2024-10-26 10:40:50

我遇到了同样的问题,发现如果我使用 --user 选项,通过 easy_install 安装 hg-git 和 dulwich 是有效的。这会将包安装到 ~/Library/Python/2.7/lib/python/site-packages 中。

要查看此选项将在您的计算机上安装软件包的位置,请运行 easy_install --help。通过 --user 选项的文档,它显示了将使用的安装目录。

I had the same problem, and found that installing hg-git and dulwich via easy_install worked if I used the --user option. This installed the package into ~/Library/Python/2.7/lib/python/site-packages.

To see where this option will install a package on your machine, run easy_install --help. By the documentation for the --user option, it shows the install directory that will be used.

ゃ懵逼小萝莉 2024-10-26 10:40:50
  1. http://bitbucket.org/durin42/hg-git 克隆 hggit
  2. 获取 hg-git来自本地计算机的路径。在我的本地计算机中 /Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
  3. 使用文本编辑器添加 ~.hgrc 文件的路径
  4. < p>添加以下代码行

    <前><代码>[扩展名]
    hggit = /Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit

  5. try to hg clone/push/pull form github

  1. clone hggit from http://bitbucket.org/durin42/hg-git
  2. get hg-git path from your local computer. in my local computer /Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
  3. add path to ~.hgrc file using your text editor
  4. add the following lines of code

    [extenstions]
    hggit = /Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
    
  5. try to hg clone/push/pull form github

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