PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
44.56k stars 7.85k forks source link

用pyinstaller封装时报file not found #11443

Closed Edmond-Lee-Zse-Wong closed 9 months ago

Edmond-Lee-Zse-Wong commented 11 months ago

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

try: from paddleocr import PaddleOCR ocr = PaddleOCR(use_angle_cls=True, lang="ch") # need to run only once to download and load model into memory img_path = 'test.png' result = ocr.ocr(img_path, cls=True) for idx in range(len(result)): res = result[idx] for line in res: print(line) except Exception as e: traceback.print_exc()

vscode运行上述代码,一切正常,使用pyinstaller库执行
`pyinstaller -F test.py`
封装为exe之后执行才会报错
- 完整报错/Complete Error Message:

Traceback (most recent call last): File "test.py", line 7, in from paddleocr import PaddleOCR File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "paddleocr__init.py", line 14, in File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "paddleocr\paddleocr.py", line 43, in File "paddleocr\paddleocr.py", line 37, in _import_file File "", line 879, in exec_module File "", line 1016, in get_code File "", line 1073, in get_data FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\18191\AppData\Local\Temp\_MEI86442\paddleocr\tools/init__.py'



我们提供了AceIssueSolver来帮助你解答问题,你是否想要它来解答(请填写yes/no)?/We provide AceIssueSolver to solve issues, do you want it? (Please write yes/no): yes

请尽量不要包含图片在问题中/Please try to not include the image in the issue.
Heryk13 commented 10 months ago

Try this, i think it will work if dont work comment there, then maybe i can help you

https://github.com/PaddlePaddle/PaddleOCR/discussions/11490#discussion-6072471

Edmond-Lee-Zse-Wong commented 9 months ago

参照 #11490,问题可以解决