依赖库安装说明
本Skill需要以下Python依赖库:
必需库
Pillow: 图片处理
pip install pillowpytesseract: OCR引擎
pip install pytesseractopencv-python: 图片预处理
pip install opencv-python # 或者更轻量的版本 pip install opencv-python-headlessnumpy: 数值计算
pip install numpypandas: 数据处理
pip install pandasopenpyxl: Excel文件操作
pip install openpyxl
快速安装(推荐)
一次性安装所有依赖:
pip install pillow pytesseract opencv-python numpy pandas openpyxl
Tesseract OCR引擎安装
pytesseract需要系统安装Tesseract OCR引擎:
Ubuntu/Debian
sudo apt-get install tesseract-ocr
sudo apt-get install tesseract-ocr-chi-sim # 中文支持
CentOS/RHEL
sudo yum install tesseract
sudo yum install tesseract-langpack-chi_sim
macOS
brew install tesseract
Windows
从 https://github.com/UB-Mannheim/tesseract/wiki 下载安装程序
验证安装
import pytesseract
print(pytesseract.get_tesseract_version())
语言包
本Skill默认使用中文和英文混合识别(chi_sim+eng)。如果需要其他语言:
- 完整语言列表: https://tesseract-ocr.github.io/tessdoc/Data-Files
- 安装更多语言包: 根据系统包管理器安装对应的tesseract-langpack
创建虚拟环境(推荐)
为了避免依赖冲突,建议使用虚拟环境:
python -m venv table_extractor_env
source table_extractor_env/bin/activate # Linux/macOS
# 或
table_extractor_env\Scripts\activate # Windows
pip install -r requirements.txt