Python easy_install 遇到“ImportError: Entry point (‘console_scripts’, ‘easy_install’) not found”错误

今天在一些Linux机器上用easy_install安装MySQLdb时,遇到的问题,记录一下吧。
使用web.py做几个RESTful API和几个网页,与MySQL交互是需要用MySQLdb这个Python库,当使用“sudo easy_install MySQL-python”命令安装MySQLdb时,提示“
Please install a more recent version first, using 'easy_install -U distribute'.”,我就执行“sudo easy_install -U distribute”命令升级distribute。没想到,升级后easy_install就不可用了,遇到的错误如下:

大约是distribute升级到0.7之后的版本,就和以前的easy_install不兼容了,因为distribute从0.7版本后就和setuptools合并在一起了,网上找了个很好用的解决办法(对CentOS、Ubuntu、Mac都适用),如下:
1. 删除easy_install命令相关的可执行文件
Check your /usr/bin and /usr/local/bin for easy_install installations and remove any old script:

2. 下载和安装distribute
Download and run distribute:

如果上面的distribute_setup.py不能下载成功,那么可以直接下载distribute源码包:https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
参考这个文档的安装过程,https://pypi.python.org/pypi/distribute/0.6.49

3. 重新执行easy_install,已经修复了。
Try again, and enjoy. E.g.:

http://stackoverflow.com/questions/6012246/why-is-python-easy-install-not-working-on-my-mac
http://pythonhosted.org/distribute/

master

Stay hungry, stay foolish.

2 Comments

master进行回复 取消回复

邮箱地址不会被公开。 必填项已用*标注

*