mysql-python与MySQL 5.6

我在安装MySQL 5.6和Python 2.6.6的服务器(CentOS 6.4 x86_64)中安装mysqlpython模块时遇到问题。

[python@localhost ~]$ rpm -qa | grep SQL MySQL-shared-compat-5.6.12-2.el6.x86_64 MySQL-server-5.6.12-2.el6.x86_64 MySQL-devel-5.6.12-2.el6.x86_64 MySQL-client-5.6.12-2.el6.x86_64 

当我尝试通过pip安装最新版本的mysql-python时

 [python@localhost ~]$ pip install MySQL-python==1.2.4 

我得到一个巨大的编译错误,结果如下:

 UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 33: ordinal not in range(128) 

在这种情况下是否有人安装了mysql-python模块?

我附上的日志文件 ,以防万一它可以帮助。

使用yum来安装所需的软件包:

 yum install MySQL-python 

另外,看起来你已经从mysql.com安装了mysql,它可能会破坏依赖关系,因为这是原始包的外观:

 [root@main ~]# yum install mysql-server Loaded plugins: downloadonly, security, versionlock Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql-server.x86_64 0:5.1.69-1.el6_4 will be installed --> Processing Dependency: mysql = 5.1.69-1.el6_4 for package: mysql-server-5.1.69-1.el6_4.x86_64 --> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.69-1.el6_4.x86_64 --> Running transaction check ---> Package mysql.x86_64 0:5.1.69-1.el6_4 will be installed ---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================== Package Arch Version Repository Size ================================================================================================================== Installing: mysql-server x86_64 5.1.69-1.el6_4 updates 8.7 M Installing for dependencies: mysql x86_64 5.1.69-1.el6_4 updates 907 k perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k Transaction Summary ================================================================================================================== Install 3 Package(s) Total download size: 9.7 M Installed size: 27 M Is this ok [y/N]: 

您可以通过强制pip使用默认的默认本地化设置来修复这个UnicodeDecodeError

 LC_ALL=C pip install MySQL-python