MacOS环境下安装Python Docling库失败问题求助
问题
在终端安装文档处理库Docling时遭遇构建错误,具体错误信息如下:
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 413, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/Users/prabhjitsingh/docling-venv/bin/python3.12', 'build.py']' returned non-zero exit status 1. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for docling-parse Failed to build docling-parse ERROR: Failed to build installable wheels for some pyproject.toml based projects (docling-parse)
已尝试重装wheel和cython,但问题未解决。安装步骤如下(其他安装方式也触发相同错误):
python3 -m venv docling-venv source docling-venv/bin/activate pip install docling
解决思路与方案
- 检查Python版本兼容性:Docling目前可能对Python 3.12支持不完善,建议切换到Python 3.11版本重新创建虚拟环境再尝试安装。
- 安装系统编译工具:docling-parse构建依赖C扩展编译,需确保系统具备编译环境:
- macOS环境下,执行
xcode-select --install安装Xcode Command Line Tools
- macOS环境下,执行
- 手动安装预编译wheel:
- 下载对应系统和Python版本的docling-parse预编译wheel文件(.whl格式)
- 在激活的虚拟环境中执行
pip install /path/to/your/docling_parse-xxx.whl - 完成后执行
pip install docling安装剩余依赖
- 升级pip及相关工具:激活虚拟环境后执行
pip install --upgrade pip setuptools wheel,再重新运行pip install docling
内容的提问来源于stack exchange,提问作者Prabhjit Singh
相关产品推荐
相关产品推荐

