参考文章 https://www.jianshu.com/p/297802d16fb4?from=timeline&isappinstalled=0
本章节主是要我安装vim +python3 +YouCompleteMe的过程中问题记录,具体安装过程见参考文章。
配置vim插件 YouCompleteMe失败
1. 没有安装g++
解决方法:yum -y install gcc-c++
2.一开始编译的是python3.6 提示PyByteArray错误。认为可能是需要按python2,所以下了python2.7并安装。
3.重新配置vmi,使vmi同时支持python2和pyhton3
./configure --prefix=/opt/vim8 --enable-fail-if-missing --enable-python3interp --enable-multibyte --enable-fontset --with-features=huge --with-python3-command=/usr/local/bin/python3 --enable-pythoninterp --with-python-command=/usr/bin/python2
4.使用上面命令后出现错误YouCompleteMe unavailable: requires Vim compiled with Python (2.7.1+ or 3.4+) support.
原因:参见https://www.jianshu.com/p/020a2d5d9637
有一个注意点:
Note: If you are using Python, your config directory might have a machine-specific name (e.g. config-3.5m-x86_64-linux-gnu). Check in /usr/lib/python[2/3/3.5] to find yours, and change the python-config-dir and/or python3-config-dir arguments accordingly.
Note for Ubuntu users: You can only use Python 2 or Python 3. If you try to compile vim with both python-config-dir and python3-config-dir, YouCompleteMe will give you an error YouCompleteMe unavailable: requires Vim compiled with Python (2.6+ or 3.3+) support, when you start VIM.
大概就是说用ubuntu的话,只能讲Python2和python3编译一个,不然就会报错,“requires Vim compiled with Python (2.6+ or 3.3+) support”
5.删除了python2软件后,将python编译为动态库后出再问题
ImportError: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
解决方法:将libpython3.6m.so.1.0拷贝到/lib64目录下重新安装vim
./configure --prefix=/opt/vim8 --enable-fail-if-missing --enable-python3interp --enable-multibyte --enable-fontset --with-features=huge --with-python3-command=/usr/local/bin/python3
解决6 的问题 又出现问题7(!><!)
7. 打开vim后出现新问题
重新安装YouCompleteMe
原来的YouCompleteMe是直接从github上下载下来,依赖没有下,所以重新使用git命令下载
git clone --recursive https://github.com/Valloric/YouCompleteMe.git
下载出错
remote: Counting objects: 34240, done.
remote: Compressing objects: 100% (19/19), done.
error: RPC failed; result=18, HTTP code = 200MiB | 43.00 KiB/s
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
解决方法: git config --global https.postBuffer 1048576000 将缓冲区扩大
8.git速度过慢,将https改为http,下行能达到正常的下载速度。
参见 https://blog.csdn.net/menghuanbeike/article/details/52963514
使用Git下载完成后,直接运行.install.py --all完成安装
9.走了很多弯路:正确的配置路径
a)安装python3或python2
b) vim加上Python配置,我用的是python3
./configure --prefix=/opt/vim8 --enable-fail-if-missing --enable-python3interp --enable-multibyte --enable-fontset --with-features=huge --with-python3-command=/usr/local/bin/python3
c)安装bundle
c)到vim的bundle目录下git安装YouCompleteMe
git clone --recursive http://github.com/Valloric/YouCompleteMe.git //使用http不要用https,下载速度很快
d) 执行YouCompleteMe目录下的install.py --all