打开VIM并运行命令:
:python print "Hello World!"
但失败了:
E448: Could not load library function _PyArg_Parse_SizeT
E263: Sorry, this command is disabled, the Python library could not be loaded.
我的环境如下:
操作系统:CentOS 7.3
Python2.7.13安装:
wget -c https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar -zxvf Python-2.7.13.tgz
cd Python-2.7.13
./configure
make
make install
Python3.6.1安装:
wget -c https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
tar -zxvf Python-3.6.1.tgz
cd Python-3.6.1/
./configure
make
make install
VIM8.0安装:
rpm -e $(rpm -qa | grep vim) --nodeps
git clone https://github.com/vim/vim.git
cd vim/src
./configure --with-features=huge --enable-pythoninterp --with-python-config-dir=/usr/local/lib/python2.7/config/ --enable-python3interp --with-python3-config-dir=/usr/local/lib/python3.6/config-3.6m-x86_64-linux-gnu/ --enable-multibyte --enable-cscope --enable-gui=auto --enable-xim --with-x --enable-fontset --disable-selinux
make
make install
vim --version | grep python
其他
echo "alias vi='vim'" >> ~/.bashrc
echo "export PATH=/usr/local/bin:\$PATH" >> ~/.bashrc
source ~/.bashrc