更新vim8.0后,MacVim中YouCompleteMe出错

原文链接:http://www.aisun.org/2017/10/vim+YouCompleteMe-unavailable/

 

vim 中YouCompleteMe出错:

YouCompleteMe unavailable: dlopen(/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-d
ynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
  Referenced from: /usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
  Expected in: flat namespace
 in /usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so


首先在终端里运行:

sudo find / -name _io.so

会把系统下所有名字带_io.so的文件路径都列出来,下面是我的:
/Applications/Google Drive.app/Contents/Resources/lib/python2.7/lib-dynload/_io.so
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
/Users/Nico/macports/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so

然后备份2.7.13的io文件到桌面

cd Desktop
mkdir backup_python
cp /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so backup_python/2.7.13_io.so

然后用老文件替换2.7.13的文件

cp /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so

然后YouCompleteMe就可以完美的工作啦!



进入vim之后出现
YouCompleteMe unavailable no module named XXX

原因就是你或者没用Vundle安装,或者Vundle由于网速太慢下载到一半不能把安装依赖包完全下载下来

       解决方案:

       进入到YouCompleteMe目录,在terminal窗口敲入   git submodule update --init --recursive

 
posted @ 2017-10-13 10:31 枫小Q 阅读(...) 评论(...) 编辑 收藏