paddleocr使用
安装Anaconda3-2023.03-1-Windows-x86_64.exe
添加环境变量
D:\ProgramData\anaconda3
D:\ProgramData\anaconda3\Scripts
D:\ProgramData\anaconda3\Library\mingw-w64\bin
D:\ProgramData\anaconda3\Library\usr\bin
D:\ProgramData\anaconda3\Library\bin
配置源
C:\Users\thzn>pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ # 配置
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud//pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
创建虚拟环境
conda create -n pp python=3.7 -y
conda activate pp
手动安装
pip install paddlepaddle==2.4.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install paddleocr
pip freeze > requirements.txt
自动安装
pip install -r requirements.txt
from paddleocr import PaddleOCR def ocr_image(img_path): result = ocr.ocr(img_path, cls=True) print('-----------'); for node1 in result: for node2 in node1: txt = (node2[1][0]); score = (node2[1][1]); print(txt, score); if __name__ == "__main__": ocr = PaddleOCR(use_angle_cls=True, use_gpu=False, lang="ch") ocr_image('./imgs/car1.jpg'); ocr_image('./imgs/ship1.jpg');