编译安装vim并支持python3,以centos7为例子
1 编译安装python3
// 卸载系统自带的python3
yum remove python3 -y
// 安装依赖
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install libffi-devel -y
// 下载源码包解压安装
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar -xvJf Python-3.7.0.tar.xz
cd Python-3.7.0
./configure --prefix=/usr/local/python3
make && make install
// zsh添加环境变量
echo 'export PATH=$PATH:/usr/local/python3/bin' >> ~/.zshrc
source ~/.zshrc
2 编译安装vim并支持python3
// 下载vim源码
git clone https://github.com/vim/vim.git
// 编译安装
cd vim
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-python3interp=yes \
--prefix=/usr/local/vim8
make && make install
// zsh添加环境变量
echo 'export PATH=$PATH:/usr/local/vim8/bin' >> ~/.zshrc
source ~/.zshrc
3 查看安装情况
vim --version | grep python
+cmdline_info +libcall -python +visual
+comments +linebreak +python3 +visualextra
链接方式: gcc -std=gnu99 -L/usr/local/lib -Wl,--as-needed -o vim -lm -ltinfo -lelf -lnsl -lselinux -ldl -L/usr/local/python3/lib/python3.7/config-3.7m-x86_64-linux-gnu -lpython3.7m -lpthread -ldl -lutil -lm
显示+python3 表示完成python3对vim的支持
网友评论