0
点赞
收藏
分享

微信扫一扫

Vim:Ubuntu18重新编译Vim8.2添加Python2支持


1.前期安装准备

sudo apt install libncurses5-dev \
libgtk2.0-dev libatk1.0-dev \
libcairo2-dev python-dev \
python3-dev git

卸载已安装版本

sudo

2.下载并编译vim,这部分要注意的是​​--with-python3-config-dir=/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/​​​和​​--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/​​​,对于Ubuntu18系统,可以直接使用我下面贴出的代码,如果是其他版本系统,需要去​​/usr/lib​​文件夹下查看自己的Python版本。

git clone https://github.com/vim/vim.git && sudo mv vim /usr
cd /usr/vim
sudo ./configure --with-features=huge --enable-multibyte --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/ --enable-python3interp=yes --with-python3-config-dir=/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/ --enable-gui=gtk2 --enable-cscope --prefix=/usr/local/
sudo make VIMRUNTIMEDIR=/usr/local/share/vim/vim82
sudo make install

设置Vim为默认editor

sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/vim 1
sudo update-alternatives --set editor /usr/local/bin/vim
sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/vim 1
sudo update-alternatives --set vi

验证安装结果

vim --version

参考:
​​​ https://github.com/ycm-core/YouCompleteMe/wiki/Building-Vim-from-source​​ https://vi.stackexchange.com/questions/11526/how-to-enable-python-feature-in-vim


举报

相关推荐

0 条评论