如果你使用类 Unix 系统,并且有足够新的 Python (2.3 更新),从源代码安装 Mercurial 就很容易了。
从 http://www.selenic.com/mercurial/download 下载最新的源代码。
gzip -dc mercurial-MYVERSION.tar.gz | tar xf -
进入源代码目录,执行安装教本。这会构建 Mercurial,安装到你的家目录。
cd mercurial-MYVERSION python setup.py install --force --home=$HOME
安装完成后,Mercurial 就位于家目录的 bin
子目录。不要忘记将这个目录加入到你的可执行文件搜索路径中。
你可能需要设置环境变量 PYTHONPATH
,以便 Mercurial 可执行文件能找到 Mercurial
包。例如,在我的笔记本电脑中,必须设置为 /home/bos/lib/python
。你需要使用的路径依赖于
Python 的构建方式,这很容易找出来。如果你不确定,仔细察看上面的安装脚本输出,检查包含 mercurial
目录的内容的安装位置。
在 Windows 中构建和安装 Mercurial 需要各种工具,相当多的技术背景,以及足够的耐心。如果你是一个“初级用户”,我很不赞成这个方法。我强烈建议你使用二进制安装包,除非你想深入研究 Mercurial 本身。
If you are intent on building Mercurial from source on Windows, follow the “hard way” directions on the Mercurial wiki at http://www.selenic.com/mercurial/wiki/index.cgi/WindowsInstall, and expect the process to involve a lot of fiddly work.