安装python-mysql包时出现问题

时间:2013-09-03 04:24:44

标签: python ubuntu-12.04 mysql-python easy-install

我有一个Ubuntu 12.04 x64服​​务器版VM,我正在运行python2.7并试图通过命令安装MySQLdb软件包(我已经安装了easy_install并且正在运行):< / p>

$ sudo easy_install MySQL-python

但是当easy_install尝试编译时,我收到以下回溯错误:

Traceback (most recent call last):
   File "/usr/local/bin/easy_install", line 9, in <module>
      load_entry_point('distribute', 'console_scripts', 'easy_install')()
   File "/usr/local/lib/python2.7/dist-packages/setuptools-1.1-py2.7.egg/pkg_resources.py", line 357, in load_entry_point
      return get_distribution(dist).load_entry_point(group, name)
   File "/usr/local/lib/python2.7/dist-packages/setuptools-1.1-py2.7.egg/pkg_resources.py", line 2393, in load_entry_point
      raise ImportError("Entry point %r not found" % ((group,name),))
ImportError: Entry point ('console_scripts', 'easy_install') not found

我的/usr/local/lib/python2.7/dist-packages显示已安装以下软件包:

  • 分发-0.7.3-py2.7.egg
  • 易于install.pth
  • pyinotify中-0.9.4-py2.7.egg
  • setuptools的-1.1-py2.7.egg
  • setuptools.pth

我不确定从哪里开始,或者为什么我甚至会收到此错误。我也不确定这个问题是否更适合ServerFault;但是,由于我在处理某些代码时遇到了这个问题,我想也许其他一些程序员也曾遇到过这个问题......(当时看似合乎逻辑)

2 个答案:

答案 0 :(得分:2)

您似乎安装了distributesetuptools,您的easy_install脚本尝试从distribute加载入口点,但首先找到setuptools

您应该删除distribute,因为它已合并回setuptools,现在已过时。可能你需要在那之后重新安装setuptools以使每个人都重新工作。

答案 1 :(得分:2)

尝试以下方法:

curl -O http://python-distribute.org/distribute_setup.py
sudo python distribute_setup.py

然后再次运行sudo easy_install MySQL-python。