pu369com

正确安装PaddleOCR的方法

 paddleocr安装起来太费劲了

pip install patch-ng

pip install paddleocr --use-pep517   (失败)

1.首先去github下载:https://github.com/PaddlePaddle/PaddleOCR,然后找个文件夹解压。(从CSDN中点开链接时会提供加速功能,跳转到了https://gitcode.net/mirrors/paddlepaddle/paddleocr?utm_source=csdn_github_accelerator )

2.安装PaddlePaddle

按照官网提供的命令:

1
python -m pip install paddlepaddle==2.5.1 -i https://mirror.baidu.com/pypi/simple

3 cd到刚才解压的PaddleOCR文件夹中,执行:

1
pip install -r requirements.txt

红色字提示:ERROR: No matching distribution found for opencv-python==4.2.0.32

 

修改  requirements.txt 直接去掉  ==4.2.0.32

再次执行:pip install -r requirements.txt

执行:pip install paddleocr

在执行到安装PyPDF时出错,提示:error: command 'swig.exe' failed: None

执行:pip install swig

再次执行:pip install paddleocr   终于成功了

2.代码

1
2
3
4
5
6
7
from paddleocr import PaddleOCR, draw_ocr
  
ocr = PaddleOCR(use_angle_cls=True, use_gpu=False)
img_path = r'F:\1.png'
result = ocr.ocr(img_path, cls=True)
for line in result:
    print(line)

  首次在CMD中运行代码时,下载了3 个文件到 C:\Users\用户名\.paddleocr\whl\rec\ch\ch_PP-OCRv4_rec_infer 目录,分别是:inference.pdiparams    inference.pdiparams.info  inference.pdmodel

删除掉下载后解压的paddleocr-develop目录,在IDLE中再次执行代码,IDLE中输出结果正常,但是有黑框一闪。

 

参考:https://blog.csdn.net/weixin_44063045/article/details/129211758

https://blog.51cto.com/u_15671528/5974388

https://pythonjishu.com/ustjibibiytohrb/

https://blog.csdn.net/weixin_64974855/article/details/132768887

https://www.paddlepaddle.org.cn/

https://blog.csdn.net/weixin_42708301/article/details/119864744

https://blog.csdn.net/qq_44133071/article/details/132521396

posted on   pu369com  阅读(1653)  评论(1编辑  收藏  举报

相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示