i compiled mercurial successfully as follows:
...
...
copying build/scripts-2.7/hg -> /usr/local/bin
changing mode of /usr/local/bin/hg to 755
running install_egg_info
Writing /usr/local/lib/python2.7/site-packages/mercurial-2.8.1-py2.7.egg-info
as3:~/mercurial-2.8.1# cd ~
as3:~# hg clone http://hg.cat-v.org/werc/
Traceback (most recent call last):
File "/usr/bin/hg", line 25, in <module>
mercurial.util.set_binary(fp)
File "/usr/local/lib/python2.7/site-packages/mercurial/demandimport.py", line 103, in __getattribute__
return getattr(self._module, attr)
AttributeError: 'module' object has no attribute 'set_binary'
as3:~#
以上运行hg时,系统调用的是/usr/bin/hg文件, 这个hg文件是以前安装mercurial而生成的。
编译的mercurial的执行文件则被安装到了/usr/local/bin下。(/usr/local/bin/hg)
当运行某个app(比如hg)时,系统会首先到/usr/bin/下,去看有无该app,如果有,就运行/usr/bin/下的
该app;如果/usr/bin/下,没有该app,系统就会到/usr/local/bin/下,去查看是否有该app,如果有的话,
就会运行/usr/local/bin/下的该app.
可见/usr/bin/下的app的运行级别要比/usr/local/bin/下的app的运行级别高(即要优先一些)
解决办法:删除/usr/bin/下的hg即可。(这个/usr/bin/hg是以前安装mercurial后所生成的。)
as3:~# /usr/local/bin/hg --version
Mercurial Distributed SCM (version 2.8.1)
(see http://mercurial.selenic.com for more information)
Copyright (C) 2005-2013 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
as3:~# /usr/bin/hg --version
Traceback (most recent call last):
File "/usr/bin/hg", line 25, in <module>
mercurial.util.set_binary(fp)
File "/usr/local/lib/python2.7/site-packages/mercurial/demandimport.py", line 103, in __getattribute__
return getattr(self._module, attr)
AttributeError: 'module' object has no attribute 'set_binary'
as3:~# rm /usr/bin/hg
as3:~# hg --version
Mercurial Distributed SCM (version 2.8.1)
(see http://mercurial.selenic.com for more information)
Copyright (C) 2005-2013 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
as3:~#
the above indicate if there is same app name under /usr/local/bin and /usr/bin,running the app will invoke the app in /usr/bin/;if in /usr/bin,there is no the app,then the app in
/usr/local/bin will be invoked.