YouCompleteMe依赖生成失败问题(非bug)求助原因及解决方法
YouCompleteMe 安装失败问题排查与解决建议
问题场景
执行以下命令安装YouCompleteMe:
python install.py
出现如下错误:
FAILED ERROR: the build failed. NOTE: it is *highly* unlikely that this is a bug but rather that this is a problem with the configuration of your system or a missing dependency. Please carefully read CONTRIBUTING.md and if you're sure that it is a bug, please raise an issue on the issue tracker, including the entire output of this script (with --verbose) and the invocation line used to run it. The installation failed; please see above for the actual error. In order to get more information, please re-run the command, adding the --verbose flag. If you think this is a bug and you raise an issue, you MUST include the *full verbose* output. For example, run:/home/ubuntu/miniconda3/bin/python /home/ubuntu/.vim/plugged/YouCompleteMe/third_party/ycmd/build.py --verbose
已尝试操作
- 分别使用系统Python环境、Conda环境、手动安装的Python 3.11.0执行安装
- 系统环境和Conda环境报上述相同错误,手动安装的Python提示缺少依赖库
当前环境信息
Conda环境列表
[10:45:47@ubuntu~/.vim/plugged/YouCompleteMe] $ conda info -e # conda environments: # base /home/ubuntu/miniconda3 nvim_py3.11_conda /home/ubuntu/miniconda3/envs/nvim_py3.11_conda
Conda环境内Python版本
[10:54:16@ubuntu~/.vim/plugged/YouCompleteMe] $ python --version Python 3.11.0
排查与解决步骤
获取完整报错日志
按照提示执行带--verbose参数的命令,定位具体失败原因:/home/ubuntu/miniconda3/bin/python /home/ubuntu/.vim/plugged/YouCompleteMe/third_party/ycmd/build.py --verbose日志会明确显示是缺失编译工具、依赖库还是环境配置冲突。
补齐核心编译依赖
YouCompleteMe编译必须的基础依赖:- C++编译工具链:Ubuntu下执行
sudo apt install build-essential安装gcc、g++、make - CMake:版本要求3.13+,Ubuntu可通过
sudo apt install cmake或Conda环境内执行conda install cmake安装 - Python开发包:系统Python安装
python3-dev,Conda环境内执行conda install python-dev - 子模块同步:如果通过vim-plug安装,执行
:PlugInstall --sync YouCompleteMe确保第三方子模块拉取完整
- C++编译工具链:Ubuntu下执行
Conda环境专属处理
- 激活目标Conda环境后,执行
which python、which cmake确认工具路径指向环境内版本,避免与系统工具冲突 - 在Conda环境内安装编译依赖:
conda install -c conda-forge cmake gcc_linux-64 gxx_linux-64 python-dev
- 激活目标Conda环境后,执行
手动Python 3.11的依赖补充
- Ubuntu下安装对应版本开发包:
sudo apt install python3.11-dev - 通过pip安装编译依赖库:
pip install pybind11 setuptools
- Ubuntu下安装对应版本开发包:
重新执行安装
依赖补齐后,回到YouCompleteMe目录执行:python install.py --verbose若需指定语言支持(如C/C++、Python),可追加参数:
python install.py --clangd-completer --python-completer
内容的提问来源于stack exchange,提问作者StudioMenghan
相关产品推荐
相关产品推荐

