macos Mercurial错误***未能导入扩展hggit:没有名为hggit的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5133641/
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-10-21 07:45:51  来源:igfitidea点击:

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

pythonmacosmercurialhg-git

提问by Stofke

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:

我在 Mac 上安装了 Mercurial,它很棒。对我来说,它比 Git 更容易掌握,所以我想用它来管理 git-repositories。因此,我按照以下说明安装了 hg-git:

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

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

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

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

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

I'd might be important to note that I'm on a Mac not a Windows PC.

需要注意的是,我使用的是 Mac 而不是 Windows PC。

Does any know how to resolve this

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

采纳答案by aknuds1

After installing hg-git with the following command:

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

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.

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

What does this say:

这是什么意思:

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

回答by pmc

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

请注意安装“mercurial-git”包以在 12.04 上获取 hggit 模块的 ubuntu 用户,一些明亮的火花随机将模块重命名为“git”,因此您需要将 ~/.hgrc 更改为类似

[extensions]
hgext.bookmarks =
git =

回答by viktorianer

I installed Python and TortoiseHg by:

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

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 bysudo pip uninstall hg-git):

我遇到了类似的问题(TortoiseHg: failed to import extension hggit: No module named hggit 等等...),最后在 mac 上找到了我的 TortoiseHg 的解决方案(首先卸载 last hg-git bysudo 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. ...

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

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

... I could push HG repository to Git:

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

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

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

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

Note 2: --traceback tells you about problems

注2:--traceback 告诉你问题

回答by delloPiro

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.

即使在下载最新的 Tortoisehg 并确保安装了 hggit 插件以及我的 .ini 和 hgrc 文件具有启用 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.

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

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.

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

回答by Ross McFarlane

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

我遇到了同样的问题,发现如果我使用该--user选项,通过 easy_install 安装 hg-git 和 dulwich 会起作用。这将软件包安装到~/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 --useroption, it shows the install directory that will be used.

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

回答by natade

  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 ~.hgrcfile 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 hgclone/push/pullform github

  1. http://bitbucket.org/durin42/hg-git克隆 hggit
  2. 从本地计算机获取 hg-git 路径。在我的本地计算机中/Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
  3. ~.hgrc使用文本编辑器添加文件路径
  4. 添加以下代码行

    [extenstions]
    hggit = /Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
    
  5. 尝试hgclone/push/pull形成github

回答by ikarayel

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

我遇到了与我通过brew install mercurial某些软件包丢失所看到的相同的问题。

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

如果有任何包丢失,请进行测试,例如: python -c "import hggit"

My fix: Uninstall all packages:

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

brew uninstall mercurial

brew uninstall mercurial

install with piplike:

安装pip类似:

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

  • sudo pip install mercurialand

  • sudo pip install hg-git

  • sudo easy_install pip(如果你没有pip

  • sudo pip install mercurial

  • sudo pip install hg-git

then

然后

hg bookmark -r default master

hg 书签 -r 默认主