python升级

2023-01-31 02:01:50 python 升级

安装系统后python版本低 需要更新更高版本

1
wget https://www.Python.org/ftp/python/2.7.9/Python-2.7.9.tgz
1
2
3
4
5
6
7
tar zxvf Python-2.7.9.tgz
./configure 
make install
make
 
mv /usr/bin/python /usr/bin/python_old
ln -s /usr/local/bin/python2.7 usr/bin/

修改yum配置文件以保证yum可用

1
2
vim /usr/bin/yum
#!/usr/bin/python   #修改此处为/usr/bin/python_old

PYPY:Http://pkgs.org/search/?keyWord=pypy

1
2
3
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/pypy-libs-2.0.2-1.el6.x86_64.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/pypy-2.0.2-1.el6.x86_64.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/pypy-devel-2.0.2-1.el6.x86_64.rpm

注意安装顺序 先安装libs 再安装pypy 最后安装devel

测试 pypy的效率要比cpython高大约三到四倍


实现Python的交互模式下tab自动补全和vim下python tab自动补全:

下面是.pythonrc.py的内容

1
2
3
4
5
6
7
try:
    import readline
except ImportError:
    print("Module readline not available.")
else:
    import rlcompleter
    readline.parse_and_bind("tab: complete")
1
2
vim ~/.bashrc
export PYTHONSTARTUP=~/.pythonrc.py #加入此行


vim下:

1
2
3
4
5
6
wget https://GitHub.com/rkulla/pydiction/arcHive/master.zip 
unzip -q master
mv pydiction-master pydiction 
mkdir -p ~/.vim/tools/pydiction
cp -r pydiction/after ~/.vim 
cp pydiction/complete-dict ~/.vim/tools/pydiction

wKioL1T_0OjzGyoZAAE_viskI84293.jpg


相关文章