Python 相关

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

wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
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可用

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

PYPY:http://pkgs.org/search/?keyword=pypy

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的内容

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


vim下:

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

你可能感兴趣的:(python,pypy,tab自动补全)