1
0

Compare commits

...

2 Commits

Author SHA1 Message Date
0bd9ec8a36 补充mac运行 2026-02-26 18:09:06 +08:00
e35d16a92e 忽略temp目录 2026-02-26 09:06:11 +08:00
2 changed files with 58 additions and 3 deletions

3
.gitignore vendored
View File

@@ -41,4 +41,5 @@ $RECYCLE.BIN/
*.swo
skills/**/test
__pycache__
__pycache__
temp

View File

@@ -188,6 +188,10 @@ uv run --with docling --with "unstructured[xlsx]" --with markdownify --with "mar
`--high-res` 优先级Docling OCR → unstructured OCR (hi_res) → Docling → unstructured (fast) → MarkItDown → pypdf
> **平台差异说明**`--high-res` 模式在不同平台上需要不同的依赖配置,详见下方各平台说明。
#### Windows x86_64
```bash
# pip - 基础文本提取fast 策略,无需 OCR
pip install docling "unstructured[pdf]" markdownify "markitdown[pdf]" pypdf
@@ -202,11 +206,42 @@ uv run --with docling --with "unstructured[pdf]" --with markdownify --with "mark
uv run --with docling --with "unstructured[pdf]" --with unstructured-paddleocr --with "paddlepaddle==2.6.2" --with ml-dtypes --with markdownify --with "markitdown[pdf]" --with pypdf parser.py report.pdf --high-res
```
> PDF 无内置 XML 原生解析,至少需要安装 pypdf。默认模式下 Docling 不启用 OCRunstructured 使用 fast 策略。指定 `--high-res` 后Docling 启用 OCRunstructured 使用 hi_res 策略配合 PaddleOCR 进行版面分析。hi_res 策略需要额外安装 `unstructured-paddleocr`、`paddlepaddle==2.6.2`、`ml-dtypes`。PaddlePaddle 必须锁定 2.x 版本3.x 在 Windows 上有 OneDNN 兼容问题。
>
> **Windows 说明**hi_res 策略需要额外安装 `unstructured-paddleocr`、`paddlepaddle==2.6.2`、`ml-dtypes`。PaddlePaddle 必须锁定 2.x 版本3.x 在 Windows 上有 OneDNN 兼容问题。
#### macOS x86_64 (Intel)
macOS x86_64 上 `docling-parse` 5.x 没有预编译 wheel需要使用 4.0.0 版本;同时 `easyocr` 与 NumPy 2.x 不兼容,需要锁定 `numpy<2`
```bash
# uv - 基础文本提取
uv run --python 3.12 --with "docling==2.40.0" --with "docling-parse==4.0.0" --with "numpy<2" --with "markitdown[pdf]" --with pypdf parser.py report.pdf
# uv - OCR 版面分析(--high-res
uv run --python 3.12 --with "docling==2.40.0" --with "docling-parse==4.0.0" --with "numpy<2" --with "markitdown[pdf]" --with pypdf parser.py report.pdf --high-res
```
> **macOS x86_64 说明**
> - 必须指定 `--python 3.12`PaddlePaddle 不支持 Python 3.14
> - `docling==2.40.0` 兼容 `docling-parse==4.0.0`(唯一有 x86_64 预编译 wheel 的版本)
> - `numpy<2` 避免 easyocr 与 NumPy 2.x 的兼容性问题
> - Docling 在 macOS 上使用 EasyOCR 作为 OCR 后端,无需安装 PaddleOCR
#### macOS arm64 (Apple Silicon) / Linux
```bash
# uv - 基础文本提取
uv run --with docling --with "unstructured[pdf]" --with markdownify --with "markitdown[pdf]" --with pypdf parser.py report.pdf
# uv - OCR 版面分析
uv run --with docling --with "unstructured[pdf]" --with markdownify --with "markitdown[pdf]" --with pypdf parser.py report.pdf --high-res
```
> **通用说明**PDF 无内置 XML 原生解析,至少需要安装 pypdf。默认模式下 Docling 不启用 OCRunstructured 使用 fast 策略。指定 `--high-res` 后Docling 启用 OCR。
### 安装所有依赖
#### Windows x86_64
```bash
# pip - 基础文本提取(不包含 PDF OCR
pip install docling "unstructured[docx,pptx,xlsx,pdf]" markdownify pypandoc-binary "markitdown[docx,pptx,xlsx]" python-docx python-pptx pandas tabulate pypdf
@@ -221,6 +256,25 @@ uv run --with docling --with "unstructured[docx,pptx,xlsx,pdf]" --with markdowni
uv run --with docling --with "unstructured[docx,pptx,xlsx,pdf]" --with markdownify --with unstructured-paddleocr --with "paddlepaddle==2.6.2" --with ml-dtypes --with pypandoc-binary --with "markitdown[docx,pptx,xlsx,pdf]" --with python-docx --with python-pptx --with pandas --with tabulate --with pypdf parser.py file.docx
```
#### macOS x86_64 (Intel)
```bash
# uv - 完整版(包含 PDF OCR
uv run --python 3.12 --with "docling==2.40.0" --with "docling-parse==4.0.0" --with "numpy<2" --with "markitdown[docx,pptx,xlsx,pdf]" --with pypandoc-binary --with python-docx --with python-pptx --with pandas --with tabulate --with pypdf parser.py file.docx
```
> macOS x86_64 上由于依赖兼容性问题,无法使用 unstructured但 docling 可以处理所有格式。
#### macOS arm64 (Apple Silicon) / Linux
```bash
# uv - 基础文本提取
uv run --with docling --with "unstructured[docx,pptx,xlsx,pdf]" --with markdownify --with pypandoc-binary --with "markitdown[docx,pptx,xlsx]" --with python-docx --with python-pptx --with pandas --with tabulate --with pypdf parser.py file.docx
# uv - 完整版(包含 PDF OCR
uv run --with docling --with "unstructured[docx,pptx,xlsx,pdf]" --with markdownify --with pypandoc-binary --with "markitdown[docx,pptx,xlsx,pdf]" --with python-docx --with python-pptx --with pandas --with tabulate --with pypdf parser.py file.docx
```
### 依赖说明
**MarkItDown**:需要按文档类型安装可选依赖,直接 `pip install markitdown` 不包含任何格式支持。