简体   繁体   English

安装python-mysql包时出现问题

[英]problems while installing python-mysql package

I've got an Ubuntu 12.04 x64 Server edition VM that I'm running python2.7 on and trying to install the MySQLdb package via the command (I've already got easy_install installed and working): 我有一个Ubuntu 12.04 x64服​​务器版VM,我正在运行python2.7并尝试通过命令安装MySQLdb软件包(我已经安装了easy_install并正常工作):

$ sudo easy_install MySQL-python

but I get the following traceback error when easy_install tries to compile: 但是当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

My /usr/local/lib/python2.7/dist-packages shows the following packages installed: 我的/usr/local/lib/python2.7/dist-packages显示了以下安装包:

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

I'm not really sure where to go from here, or why I'm even getting this error. 我不确定从哪里开始,或者为什么我甚至得到这个错误。 I also wasn't sure if this question would be better suited for ServerFault; 我也不确定这个问题是否更适合ServerFault; but, since I ran into this issue while working on some code, I thought maybe some other coders had ran into it before too...(seemed logical at the time) 但是,由于我在处理一些代码时遇到了这个问题,我想也许其他一些编码器也遇到过它......(当时似乎合乎逻辑)

You seem to have installed distribute and setuptools , your easy_install script tries to load the entry point from distribute , but setuptools is found first. 您似乎已经安装了distributesetuptools ,您的easy_install脚本尝试从distribute加载入口点,但setuptools找到setuptools

You should remove distribute , as it has been merged back into setuptools and is now obsolete. 您应该删除distribute ,因为它已合并回setuptools ,现在已过时。 Probably you'll need to reinstall setuptools after that to get everyting working again. 可能之后你需要重新安装setuptools才能让setuptools都重新工作。

try the following: 尝试以下方法:

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

then run sudo easy_install MySQL-python again. 然后再次运行sudo easy_install MySQL-python。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM