我使用的是安装了 Mercurial TortoiseHg 的 Windows XP。现在我需要安装外部活动延伸 https://www.mercurial-scm.org/wiki/ActivityExtension。我下载了该扩展并在 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?我在中找到了一些解释乌龟汞常见问题解答 http://tortoisehg.bitbucket.io/manual/0.9/faq.html,在“TortoiseHg 扩展在 Windows 上哪里查找外部 Python 模块?”标题下
但是,当我执行那里写的步骤时,我收到与上面相同的错误消息。
我尝试了该方法,似乎效果很好。
您需要将路径包含为
import sys
sys.path.append(r'C:\Python26\Lib\site-packages')
另请参阅以下代码@http://bitbucket.org/tortoisehg/stable/src/cf4b3dfd15ee/contrib/hg 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 查看捆绑目录之外的非标准路径。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)