【问题标题】:Issue with installing Mercurial Activity extension安装 Mercurial Activity 扩展的问题
【发布时间】:2010-10-29 14:27:30
【问题描述】:

我使用的是安装了 Mercurial TortoiseHg 的 Windows XP。现在我需要安装外部activity extension。我下载了扩展并在 hgrc 中启用了它。

当我尝试使用命令调用它时:

hg activity

我收到以下错误:

There are 292 changesets
Hg activity options: you need matplotlib in your python path in order to use the hg activity extension.

然后我安装了 python 2.6 和 matplotlib。所以它们的路径是:

  • D:\Python26\
  • D:\Python26\Lib\site-packages\matplotlib

现在我不知道如何告诉 mercurial 活动扩展从该位置使用 matplotlib?我在TortoiseHg FAQ 中找到了一些解释,标题为“TortoiseHg 扩展在哪里查找 Windows 上的外部 Python 模块?”

但是当我执行那里写的步骤时,我收到与上面相同的错误消息。

【问题讨论】:

    标签: windows mercurial tortoisehg


    【解决方案1】:

    我尝试了这种方法,似乎效果很好。

    您需要将路径包含为

    import sys
    sys.path.append(r'C:\Python26\Lib\site-packages')
    

    另见以下代码@http://bitbucket.org/tortoisehg/stable/src/cf4b3dfd15ee/contrib/hg

    # enable importing on demand to reduce startup time
    try:
        from mercurial import demandimport; demandimport.enable()
    except ImportError:
        sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
                         ' '.join(sys.path))
        sys.stderr.write("(check your install and PYTHONPATH)\n")
        sys.exit(-1)
    

    您也应该能够在 PYTHONPATH 环境变量中添加以下路径(D:\Python26\Lib\site-packages)。

    这应该允许与 TortoiseHg 捆绑的 python 查看捆绑目录之外的非标准路径。

    【讨论】:

    • 我遇到了完全相同的问题,有人可以解释一下 import sys sys.path.append(r'C:\Python26\Lib\site-packages') 应该去哪里吗?我正在使用python27。我已将 D:\Python27\ 和 D:\Python27\Lib\site-packages\matplotlib 添加到我的环境变量(Windows)中。到目前为止,我的 mercurial.ini 应该是什么样子,我在 [extensions] 下有 activity=C:\myHgActivity\hgactivity-2.0\activity。多一点细节对我会有很大帮助。
    • @pyfun 我刚刚遇到了同样的问题。虽然我将站点包添加到 PYTHONPATH 它仍然拒绝工作。在砍掉那些愚蠢的口袋妖怪异常处理块后,我得到了这个错误:没有名为 matplotlib.figure 的模块!
    【解决方案2】:

    抱歉,来晚了。我最终安装了 python 2.7,并从命令行运行 hg

    安装 python 并将其添加到您的路径后,从 windows 命令提示符运行以下命令:

    python -m pip install -U pip setuptools
    python -m pip install matplotlib
    python -m pip install mercurial
    

    在克隆 hgactivity 之后

    hg clone http://sources.freehackers.org/Hgactivity/
    

    然后将其添加到您的 mercurial.ini 文件中:

    [extensions]
    activity = C:\Repos\Hgactivity\activity
    

    现在从命令行你应该可以做到这一点:

    C:\Python27\Scripts\hg activity --help
    

    希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 2011-07-25
      • 1970-01-01
      • 2017-01-17
      • 1970-01-01
      • 1970-01-01
      • 2015-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多