You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Ubuntu 22.04.03上用pipenv替代conda运行localGPT?

解决ImportError: cannot import name 'PDFResourceManager' from 'pdfminer.converter'

问题根源

你指定的pdfminer.six==20221105版本中,PDFResourceManager类实际位于pdfminer.pdfinterp模块,而非pdfminer.converter。但你使用的unstructured(因版本设为*会自动拉取最新版)的PDF分区代码仍从旧路径导入该类,导致版本兼容性错误。

修复步骤

1. 锁定unstructured兼容版本

修改Pipfile,将unstructured指定为与pdfminer.six==20221105兼容的版本,例如0.7.12:

unstructured = {extras = ["pdf"], version = "==0.7.12"}

2. 重建pipenv环境

执行以下命令清理旧依赖并重新安装:

pipenv clean
pipenv install
pipenv lock

3. 验证修复

重新进入虚拟环境并运行导入脚本:

pipenv shell
python ingest.py

备选方案:调整pdfminer.six版本

若上述方案仍有问题,可升级pdfminer.six并适配对应unstructured版本:
修改Pipfile:

pdfminer.six = "==20230726"
unstructured = {extras = ["pdf"], version = "==0.10.30"}

重复步骤2和3即可。


内容的提问来源于stack exchange,提问作者chamaoskurumi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 11:35:07