Mercurial 错误 *** 无法导入扩展 hggit:没有名为 hggit 的模块
我在 Mac 上安装了 Mercurial,效果非常好。对我来说,它比 Git 更容易掌握,所以我想用它来管理 git 存储库。因此,我按照以下说明安装了 hg-git:
但是,每次我发出 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:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
对于安装“mercurial-git”软件包以在 12.04 上获取 hggit 模块的 ubuntu 用户请注意,一些明亮的 Spark 随机将该模块重命名为“git”,因此您需要将 ~/.hgrc 更改为如下所示
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
使用以下命令安装 hg-git 后:
以下命令有效吗?
这对您意味着什么:
后一个命令的目的是验证 Python hg 是否在安装了 hggit 的情况下运行。就我而言,它显示“#!/usr/bin/python”,这是我的标准 python 命令。
这句话说什么:
After installing hg-git with the following command:
Does the following work?
What does this say for you:
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:
我通过以下方式安装了Python和TortoiseHg:
安装后
我遇到了类似的问题(TortoiseHg:无法导入扩展hggit:没有名为hggit的模块等等...),最后找到了我的TortoiseHg的解决方案mac(首先通过
sudo pip uninstall hg-git
卸载最后一个hg-git):使用pip安装并向所有重要分支添加书签后,例如
......我可以将 HG 存储库推送到 Git:
注意:使用 ssh! - 减少大型存储库的问题
注释 2:--traceback 告诉您问题
I installed Python and TortoiseHg by:
After following installation
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
):After installation with pip and adding bookmarks to all important branches, e. g. ...
... I could push HG repository to Git:
Note: use ssh! - causes fewer problems with large repositories
Note 2: --traceback tells you about problems
即使在下载了最新的 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.
我遇到了与通过
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
然后
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 havepip
)sudo pip install mercurial
andsudo pip install hg-git
then
我遇到了同样的问题,发现如果我使用
--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./Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
~.hgrc
文件的路径<前><代码>[扩展名]
hggit = /Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
try to
hg
clone/push/pull
form github/Users/coco/go/src/bitbucket.org/durin42/hg-git/hggit
~.hgrc
file using your text editoradd the following lines of code
try to
hg
clone/push/pull
form github