请先安装python
然后安装paddlepaddle
python -m pip install paddlepaddle==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
进入python解释器
D:>python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
import paddle;
paddle.utils.run_check();
Running verify PaddlePaddle program …
I0911 17:54:54.118322 2356 program_interpreter.cc:243] New Executor is Running.
I0911 17:54:54.237195 2356 interpreter_util.cc:648] Standalone Executor is Used.
PaddlePaddle works well on 1 CPU.
PaddlePaddle is installed successfully! Let’s start deep learning with PaddlePaddle now.
这样表示完成了。
然后我们需要安装ocr等扩展
pip install opencv-python
pip install paddlepaddle
pip install paddleocr
pip install pillow
pip install numpy
pip install pyautogui
pip install matplotlib
最后在VS添加一个Python项目并且放一个1.PNG的图片
添加以下代码:编译即可
# coding=gb2312
from paddleocr import PaddleOCR;
ocr = PaddleOCR(predict_system=True,lang="ch");
img_path = "1.PNG";
result = ocr.ocr(img_path,det=True)
for res in result :
for line in res:
print(line)
关于作者