使TortoiseHG使用我的Python安装 [英] Make TortoiseHG use my Python installation

查看:129
本文介绍了使TortoiseHG使用我的Python安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Mercurial创建了一些python钩子,这些钩子使用了一些外部库(即jira-python).在Linux中,我使用pip安装软件包.但是,在Windows中,Mercurial随附了捆绑版本的Python.我的挂钩在运行时失败,因为未安装外部软件包.

I created some python hooks for Mercurial that use some external libraries (namely jira-python). In Linux, I install the packages using pip. In Windows, however, Mercurial comes with a bundled version of Python. My hooks fail when I run them because the external packages are not installed.

我想让Mercurial/TortoiseHG使用我的Python安装程序,以便可以控制其环境.我怎样才能做到这一点?

I want to make Mercurial / TortoiseHG use my Python installation so I can control its environment. How can I do that?

推荐答案

您可以为Python安装Mercurial软件包:

You can install Mercurial package for Python:

  • Mercurial 2.4 Python 2.7 package - x86 Windows
  • Mercurial 2.4 Python 2.7 package - x64 Windows

有关TortoiseHG特定的详细信息,我建议检查%TortoiseHg%\ library.zip-它包含TortoiseHG | Mercurial Python模块所需的(全部?全部?),您可以(尝试)对其进行扩展:是TortoiseHG的Python路径?"主题Steve Borho :

For TortoiseHG-specific details I can suggest to inspect %TortoiseHg%\library.zip - it contains (some? all?) needed for TortoiseHG|Mercurial Python's modules, which list you can (try) to extend: "in Where is the Python path for TortoiseHG?" topic Steve Borho wrote:

TortoiseHg的整个python环境包含在打包的library.zip中

TortoiseHg's entire python environment is contained within the library.zip that comes packaged with it.

我怀疑您可以做的是在审阅扩展文件的顶部添加一两行,以在尝试导入simplejson之前将已安装的python路径添加到sys.path中.

What I suspect you can do is add a line or two to the top of your reviewboard extension file to add your installed python path to sys.path before trying to import simplejson

将python路径添加到sys.path的提示也适用于您

Hint for adding python path to sys.path is applicable for you too

转换扩展程序"页面中的建议

您需要使用安装在独立Python之上的Mercurial,并且可能还需要执行类似的操作

you'll need to use a Mercurial installed on top of a stand-alone Python, and you may also need to do something like

set HG=python c:\Python25\Scripts\hg

如果您还安装了默认的Win32二进制文件,则覆盖它们.

to override the default Win32 binaries if you have those installed also

这篇关于使TortoiseHG使用我的Python安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆