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.zip
creating: 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