【问题标题】:error installing MySQL-python on RHEL 6在 RHEL 6 上安装 MySQL-python 时出错
【发布时间】:2014-12-01 11:37:03
【问题描述】:

我已经尝试过 yum install MYSQL-python、pip install MySQL-python 和 easy_install MySQL-python。

得到这个错误:error: command 'gcc' failed with exit status 1

Cleaning up...
Command /usr/local/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/MySQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rpOkcR-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/MySQL-python
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 8, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 65: ordinal not in range(128)

yum install 成功了,它说:Package MySQL-python-1.2.3-0.3.c1.1.el6.x86_64 already installed and latest version.

但是当我打开 python 并输入 : import MySQLdb 时,它会显示ImportError: No module named mysqldb

甚至尝试通过 yum install gcc 或 yum install python-devel 手动安装 gcc...都没有成功。

【问题讨论】:

    标签: python gcc pip mysql-python yum


    【解决方案1】:

    将终端编码设置为UTF-8,在终端中运行以下命令:

    export LC_ALL=en_US.UTF-8
    export LANG=en_US.UTF-8
    export LANGUAGE=en_US.UTF-8
    

    【讨论】:

    • 这没有提供问题的答案。要批评或要求作者澄清,请在其帖子下方发表评论。
    • @GerarddeVisser 现在可以了吗?
    【解决方案2】:

    找到答案:yum install mysql-devel.x86_64

    似乎 yum install mysql-devel 没有这样做。必须更具体..

    Install mysql-python return error in CentOs

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-21
      • 2015-04-16
      • 2013-05-10
      • 2012-12-01
      相关资源
      最近更新 更多