Multiple versions of mercurial installed - how to set one to be the default
I have two versions of mercurial installed on my Mac OS 10.6.6 and I want to use one of them by default.
I installed mercurial with a binary from here. I have been running mercurial from the terminal with the hg
command as it is installed in
/Library/Python/2.6/site-packages
even though I mostly use Python 2.7.
As a side note, the other Python 2.6 site-packages directory located at
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python2.6/site-packages
did not have mercurial installed.
Using mercurial with 2.6 while mostly using 2.7 for everything else finally caught up to me. (See this thread.)
I have since installed mercurial (with pip, not the binary from the website) for Python 2.7 in
/Library/Frameworks/Python.framework/Version开发者_运维知识库s/2.7/lib/python2.7/site-packages/
but I'm not sure how to indicate which mercurial the hg
command should use by default. It is using the original 2.6 one right now and I want to use the newer, 2.7 one from now on.
Virtualenv would be a best solution for you.
http://stevelosh.com/blog/2009/06/how-to-contribute-to-mercurial/
See that link. Leave out the contributing part. Just create a virtual env and instead of doing the ln -s commands, do a pip install mercurial there. And the rest should work fine.
Never mind - in the last few minutes I looked all over for the hg
command.
It found them in
/usr/local/bin/hg
which was put there by the binary downloaded from the website some time ago, and
/Library/Frameworks/Python.framework/Versions/2.7/bin/hg
which was created today when I installed with pip
.
So I just renamed /usr/local/bin/hg
to /usr/local/bin/hg-2.6
and symlinked /usr/local/bin/hg
to /Library/Frameworks/Python.framework/Versions/2.7/bin/hg
.
精彩评论