pip?install paddlehub
hub install chinese_ocr_db_crnn_mobile
提示錯誤:
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:1. Downgrade the protobuf package to 3.20.x or lower.2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
遇到問題,沒仔細看,就網上搜,https://blog.csdn.net/qq_51447436/article/details/125573273
嘗試一: pip install protobuf==3.19.0
提示錯誤:paddlepaddle 要求 protobuf>=3.20.2 。卸載 protobuf 3.19.0, pip install protobuf 換回來。
嘗試二: export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python,錯誤:
Download https://bj.bcebos.com/paddlehub/paddlehub_dev/chinese_ocr_db_crnn_mobile_1.2.0.zip
[##################################################] 100.00%
Decompress /root/.paddlehub/tmp/tmpmedc4u4e/chinese_ocr_db_crnn_mobile_1.2.0.zip
double free or corruption (out)
Segmentation fault (core dumped)
仔細看錯誤提示,嘗試三:(先退出shell 再進) pip install protobuf==3.20.3, 錯誤:
File "/usr/local/py311/lib/python3.11/site-packages/paddlehub/utils/xarfile.py", line 109, in __exit__raise exit_exception(exit_value)
zlib.error: Error -2 while decompressing data: inconsistent stream state
cd /root/.paddlehub/tmp/tmpmedc4u4e/ ,unzip chinese_ocr_db_crnn_mobile_1.2.0.zip,
Archive: chinese_ocr_db_crnn_mobile_1.2.0.zipcreating: chinese_ocr_db_crnn_mobile/creating: chinese_ocr_db_crnn_mobile/assets/inflating: chinese_ocr_db_crnn_mobile/assets/ppocr_keys_v1.txt inflating: chinese_ocr_db_crnn_mobile/assets/simfang.ttf inflating: chinese_ocr_db_crnn_mobile/character.py creating: chinese_ocr_db_crnn_mobile/inference_model/creating: chinese_ocr_db_crnn_mobile/inference_model/angle_cls/inflating: chinese_ocr_db_crnn_mobile/inference_model/angle_cls/model.pdiparams inflating: chinese_ocr_db_crnn_mobile/inference_model/angle_cls/model.pdmodel creating: chinese_ocr_db_crnn_mobile/inference_model/character_rec/inflating: chinese_ocr_db_crnn_mobile/inference_model/character_rec/model.pdiparams inflating: chinese_ocr_db_crnn_mobile/inference_model/character_rec/model.pdmodel inflating: chinese_ocr_db_crnn_mobile/module.py inflating: chinese_ocr_db_crnn_mobile/README.md inflating: chinese_ocr_db_crnn_mobile/README_en.md inflating: chinese_ocr_db_crnn_mobile/test.py inflating: chinese_ocr_db_crnn_mobile/utils.py extracting: chinese_ocr_db_crnn_mobile/__init__.py
再次安裝,成功: hub install chinese_ocr_db_crnn_mobile
[ INFO] - Successfully installed chinese_ocr_db_crnn_mobile-1.2.0