pip安装MySQL-python报错UnicodeDecodeError

做了一个抓网页的程序,重新配置一下环境,运行时候发现,缺少mysqldb模块

于是使用pip安装MySQL-python,结果报错如下:

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/MySQL-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-TIlEQj-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/MySQL-python
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
  File "/usr/lib/python2.6/site-packages/pip/__init__.py", line 148, in main
    return command.main(args[1:], options)
  File "/usr/lib/python2.6/site-packages/pip/basecommand.py", line 169, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 20: ordinal not in range(128)

查了一会儿,一开始以为缺少mysql-devel,安装后发现还是不行,后来发现是缺少python-devel

于是

yum install python-devel
再次安装即可。

你可能感兴趣的:(mysql-python)