因为要通过 pip 安装 MySQLdb,于是需要 gcc 编译,但是 yum install gcc 的时候得到如下提示:
# yum install gcc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base:
mirrors.163.com
* epel: mirrors.ustc.edu.cn
* extras: mirrors.grandcloud.cn
* updates: mirrors.grandcloud.cn
Excluding Packages in global exclude list
Finished
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.1.2-52.el5 set to be updated
--> Processing Dependency: cpp = 4.1.2-52.el5 for package: gcc
--> Processing Dependency: libgomp >= 4.1.2-52.el5 for package: gcc
--> Processing Dependency: libgcc >= 4.1.2-52.el5 for package: gcc
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc
--> Running transaction check
---> Package cpp.x86_64 0:4.1.2-52.el5 set to be updated
---> Package glibc-devel.x86_64 0:2.5-81 set to be updated
--> Processing Dependency: glibc-headers = 2.5-81 for package: glibc-devel
--> Processing Dependency: glibc-headers for package: glibc-devel
---> Package libgcc.i386 0:4.1.2-52.el5 set to be updated
---> Package libgcc.x86_64 0:4.1.2-52.el5 set to be updated
---> Package libgomp.x86_64 0:4.4.6-3.el5.1 set to be updated
--> Running transaction check
---> Package glibc-headers.x86_64 0:2.5-81 set to be updated
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers
--> Processing Dependency: kernel-headers for package: glibc-headers
--> Finished Dependency Resolution
glibc-headers-2.5-81.x86_64 from base has depsolving problems
--> Missing Dependency: kernel-headers >= 2.2.1 is needed by package glibc-headers-2.5-81.x86_64 (base)
glibc-headers-2.5-81.x86_64 from base has depsolving problems
--> Missing Dependency: kernel-headers is needed by package glibc-headers-2.5-81.x86_64 (base)
Error: Missing Dependency: kernel-headers is needed by package glibc-headers-2.5-81.x86_64 (base)
Error: Missing Dependency: kernel-headers >= 2.2.1 is needed by package glibc-headers-2.5-81.x86_64 (base)
You could try using --skip-broken to work around the problem
You could try running: package-cleanup --problems
package-cleanup --dupes
rpm -Va --nofiles --nodigest
解决办法是,打开 /etc/yum.conf 然后找到这行:
exclude=kernel*
修改为:
exclude=
就可以安装 gcc 了。