1. 问题
使用vim安装代码自动补全插件时遇到要求Python版本>3.5,从官网源码安装后,安装
YouCompleteMe时出现动态库问题,显示如下
txt@txt-CN15S:~/.vim/bundle/YouCompleteMe$ ./install.sh
WARNING: this script is deprecated. Use the install.py script instead.
Searching Python 3.6 libraries...
ERROR: found static Python library (/usr/local/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a) but a dynamic one is required. You must use a Python compiled with the --enable-shared flag. If using pyenv, you need to run the command:
export PYTHON_CONFIGURE_OPTS="--enable-shared"
before installing a Python version.
2.解决方案
原因:YouCompleteMe安装文件自动定位动态库错误.
修改:自动添加替换动态库查找函数
手动将 /third_party/ycmd/build.py 内的FindPythonLibraries()函数替换为以下内容,其中返回的是自己版本的Python动态库.
def FindPythonLibraries():
return ('/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so', '/usr/include/python3.6')
3.结果
安装成功,第四行第5行显示找到