安装Mercurial Activity扩展的问题

Dan*_*ric 5 windows mercurial tortoisehg

我正在使用安装了Mercurial TortoiseHg的Windows XP.现在我需要安装外部活动扩展.我下载了扩展程序并在hgrc中启用了它.

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

hg activity
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

There are 292 changesets
Hg activity options: you need matplotlib in your python path in order to use the hg activity extension.
Run Code Online (Sandbox Code Playgroud)

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

  • d:\ Python26 \
  • d:\ Python26\LIB \站点包\ matplotlib

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

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

pyf*_*unc 1

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

您需要将路径包含为

import sys
sys.path.append(r'C:\Python26\Lib\site-packages')
Run Code Online (Sandbox Code Playgroud)

另请参阅以下代码@ 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)
Run Code Online (Sandbox Code Playgroud)

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

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