OS: Windows Python version: PYTHon3.6 PaddleOCr :2.0.1 PaddlePaddle :2.0.0


Paddleocr: paddleocr: paddleocr: Paddleocr: Paddleocr Now we directly use PIP for installation, but there are many pits in the process. After several attempts, we finally found a suitable way

The installation process is as follows:

First install paddleocr

pip install paddleocr==2.01.
Copy the code

The errors are as follows

Microsoft Visual C++ 14.0 Microsoft Visual C++ 14.0 Microsoft Visual C++ 14.0

We use www.lfd.uci.edu/~gohlke/pyt… Web site kind of WHL file to install

Download it and put it in the Scripts folder in your virtual environment,

Execute in a virtual environment

pip install python_Levenshtein-0.12. 0-cp36-cp36m-win_amd64.whl
Copy the code

PIP install paddleocr==2.0.1 after python_Levenshtein is installed, we run PIP install paddleocr==2.0.1

We will find that we are ready to complete the installation

When installing a higher version, paddleocr==2.0.3 will still cause the same fasttext error as python_Levenshtein, but the python_Levenshtein fix didn’t work, so I wisely chose to abandon the higher version.

First install paddlePaddles

I ran the test code directly after installing paddleocr and got the following question

ModuleNotFoundError: No module named 'paddle'
Copy the code

Obviously we need to install PaddlePaddle, in this case the 2.0.0 CPU version is selected, and the version in this place can be felt

pip install paddlepaddle==2.0. 0 -i https://mirror.baidu.com/pypi/simple
# or
pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
Copy the code

This installation process generally does not appear what unitary

The test code

Verify that the above installation process works

from paddleocr import PaddleOCR, draw_ocr


ocr = PaddleOCR()  # need to run only once to download and load model into memory
img_path = '1.png'
result = ocr.ocr(img_path)
for line in result:
    print(line)
Copy the code

We can get the identified text and coordinate information and the confidence level

There is another unitary phenomenon here

from paddleocr import PaddleOCR, draw_ocr
ocr = PaddleOCR()  # need to run only once to download and load model into memory
img_path = '1.png'
result = ocr.ocr(img_path,cls=True)
for line in result:
  print(line)
Copy the code

If we set the CLS parameter to True, an error will be reportedFrom the source point of view: The text_classifier appears during the callbackThat’s why the above error occurs

  • The first solution: in the case of not affecting the use, CLS =True can be removed, will not affect the effect.
  • The second solution is OCR = PaddleOCR(usE_ANGLE_CLs =True, use_gpu=False, lang=’ch’), which is initialized with usE_ANGLE_cls =True.