1、Error_Info 1: INFO: Can't locate Tcl/Tk libs and/or headers

1.1 解决

yum install tcl-devel
yum install tk-devel

1.2 原因

参考:
You may have to install Tcl and Tk(when using RPM, install the –devel RPM as well) and /or edit the setup.py script to point to the right locations where Tcl/Tk is installed. If you install Tcl/Tk in the default locations, simply rerunning “make” should build the _tkinter extension.

2、Error_Info 2: Python build finished, but the necessary bits to build these modules were not found

错误信息如下示:
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _tkinter bsddb185
dl imageop sunaudiodev

解决:
在CentOS下,可以安装这些依赖包:readline-devel,sqlite-devel,bzip2-devel.i686,openssl-devel.i686,gdbm-devel.i686,libdbi-devel.i686,ncurses-libs,zlib-devel.i686。完成这些安装之后,可以再次编译。

$ yum install readline-devel sqlite-devel bzip2-devel.i686 openssl-devel.i686 gdbm-devel.i686 libdbi-devel.i686 ncurses-libs,zlib-devel.i686
$ make && make install

此解决办法参考:Python编译安装遇到的问题

3、多版本共存解决:安装完python2.7之后,还是显示旧版(2.6)

问题如图:
clipboard.png

解决:

# 把原来的python重命名成python_old,注意不要删除它
$ mv /usr/bin/python /usr/bin/python_old
# 建立新的python的软链接,/usr/local/python27为你刚才的安装目录
$ ln -s /usr/local/python27/bin/python /usr/bin/

4、yum错误:解决因python版本变化,引起的yum问题

问题如图:
clipboard.png

解决:
修改yum脚本(因为yum脚本使用python解析的)

vim /usr/bin/yum
# 进入文件,修改首行#!/usr/bin/python 为旧版的python2.6(这个是我本机的)
#!/usr/bin/python2.6

参考:升级python到最新2.7.x -- linux
success!
over~


fevin
1.1k 声望24 粉丝