python3交互模式下 按上翻箭头显示乱码_CentOS 6.3中,Python-2.7.3交互模式下方向键、退格键等出现乱码...
CentOS 6.3中,Python-2.7.3交互模式下方向鍵、退格鍵等出現亂碼
#安裝readline-devel
# yum install readline-devl
#重新安裝python
1. 準備工作
下載源碼包
如果沒有安裝make工具
~#rpm -qa|grep make
yum -y install gcc automake autoconf libtool make
安裝zlib
yum install zlib-devel
安裝openssl
yum install openssl*
安裝bzip2依賴庫
yum install -y bzip2*
2. 編譯安裝
cp Python-2.7.3.tar.bz2 /usr/src/
tar -jxvf Python-2.7.3.tar.bz2
vi Modules/Setup.dist
找到
#SSL=/usr/local/ssl
#_ssl _ssl.c \
#?????? -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
#?????? -L$(SSL)/lib -lssl -lcrypto
......
#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
把注釋去掉
編譯
./configure --prefix=/usr/local/python2.7
makeallmake install
makecleanmake distclean
建立python2.7 軟鏈
~#mv /usr/bin/python /usr/bin/python.bak~#ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python2.7
~#ln -s /usr/bin/python2.7 /usr/bin/python
3. 解決yum無法使用的問題
~#yum update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.7.3 (default, Dec 18 2013, 15:43:35)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
因為centos 6.3 下yum默認使用的是python2.6
vi /usr/bin/yum
----------------------------------------------------
#!/usr/bin/python
import sys
try:
import yum
except ImportError:
.......
修改為:
#!/usr/bin/python2.6........
總結
以上是生活随笔為你收集整理的python3交互模式下 按上翻箭头显示乱码_CentOS 6.3中,Python-2.7.3交互模式下方向键、退格键等出现乱码...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Vim编辑器学习笔记
- 下一篇: 灰色马尔科夫模型matlab实现