I easy_install'ed Mercurial, and now I get “No script named 'hg'”

烂漫一生 提交于 2019-12-24 23:53:41

问题


I installed Mercurial on (32-bit) Ubuntu 9.10, using:

sudo easy_install mercurial

It installed Mercurial 1.7.5.

I have since learned that using this way of installing is denounced by the Mercurial Team, although the reasons why it shouldn't work are not clear.

When I ran the command hg it responded:

Traceback (most recent call last):
  File "/usr/local/bin/hg", line 5, in <module>
    pkg_resources.run_script('mercurial==1.7.5', 'hg')
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 448, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 1160, in run_script
    raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'hg'

How do I fix this? How do I easy_uninstall it?

Note: I have noticed sudo hg works.


回答1:


Go to /usr/local/lib/python2.6/dist-packages (or the appropriate directory for your Python install).

Type ls -l and you will find an entry something like so.

drwx--S--- 5 root staff 4096 Feb 14 11:13 mercurial-1.7.5-py2.6-linux-i686.egg

You don't have access to that if you are not logged in as root. Try:

sudo chmod -R o+rX mercurial-1.7.5-py2.6-linux-i686.egg/

That gives you access and was enough to get things going again for me.

I still don't know how to uninstall the original mess that was made.



来源:https://stackoverflow.com/questions/4991910/i-easy-installed-mercurial-and-now-i-get-no-script-named-hg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!