解决YouCompleteMe unavailable: requires Vim compiled with Python 2.x support

问题描述:

最近自己手动编译了vim之后,每次用vim打开文件都会提示

YouCompleteMe unavailable: requires Vim compiled with Python 2.x support
UltiSnips requires py >= 2.7 or py3,开始在网上查找解决方法


原因分析:

1.先用python -V指令查到我电脑上的python版本 是2.7.12应该是可以的

2.大部分解决方案是加入--enable-pythoninterp=yes参数。如果想开启Python3支持,则--enable-python3interp=yes,我看了下我的编译脚本是有加这两个参数的

3.有查到说这两个参数不能同时打开,只能打开一个的,重新编译测试也不行


解决方案:

最终解决办法是安装python-dev;

ubuntu下直接sudo apt-get install python-dev

安装完毕之后,重新编译安装vim,测试打开vim的时候不会提示不支持的问题了

最后附上我的编译脚本

#!/bin/bash

./configure --with-features=huge \
    --enable-multibyte \
    --enable-rubyinterp=yes \
    --enable-pythoninterp=yes \
    --with-python-config-dir=/usr/lib/python2.7/config \
    --enable-python3interp=yes \
    --with-python3-config-dir=/usr/lib/python3.7/config \
    --enable-perlinterp=yes \
    --enable-luainterp=yes \
    --enable-gui=gtk2 \
    --enable-cscope \
    --prefix=/usr/local
 make 
 sudo make install


版权声明:本文为qq_29536949原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。