我在安装时遇到问题mysql-python我的服务器(CentOS 6.4 x86_64)中安装了 MySQL 5.6 和 Python 2.6.6 的模块。
[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
当我尝试安装最新版本的mysql-python通过 pip:
[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在这种情况下模块?
我附上了日志档案以防万一有帮助。
答案1
您可以通过强制 pip 使用默认的本地化设置来修复此 UnicodeDecodeError
LC_ALL=C pip install MySQL-python
答案2
用于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]: