{"id":10509,"date":"2023-10-30T15:45:12","date_gmt":"2023-10-30T07:45:12","guid":{"rendered":"https:\/\/h5app.yimenapp.cn\/h5app\/2023\/ruanjiankf\/10509\/"},"modified":"2023-10-30T15:45:12","modified_gmt":"2023-10-30T07:45:12","slug":"paddleocr%e6%89%93%e5%8c%85%e6%88%90exe%e6%9c%89%e4%bb%80%e4%b9%88%e7%94%a8%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/h5app.yimenapp.cn\/h5app\/2023\/ruanjiankf\/10509\/","title":{"rendered":"paddleocr\u6253\u5305\u6210exe\u6709\u4ec0\u4e48\u7528\uff1f"},"content":{"rendered":"<p>PaddleOCR\u662f\u4e00\u4e2a\u57fa\u4e8ePaddlePaddle\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u7684OCR\uff08Optical Character Recognition\uff09\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u6587\u672c\u8bc6\u522b\u3001\u56fe\u50cf\u8bc6\u522b\u7b49\u573a\u666f\u3002\u5728\u4f7f\u7528PaddleOCR\u65f6\uff0c\u6211\u4eec\u901a\u5e38\u9700\u8981\u5728Python\u73af\u5883\u4e0b\u8fd0\u884c\u4ee3\u7801\uff0c\u4f46\u6709\u65f6\u6211\u4eec\u9700\u8981\u5c06\u5176\u6253\u5305\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff08exe\uff09\u4ee5\u4fbf\u5728\u5176\u4ed6\u7535\u8111\u4e0a\u8fd0\u884c\u3002<\/p>\n<p>PaddleOCR\u6253\u5305\u6210exe\u7684\u539f\u7406\u6bd4\u8f83\u7b80\u5355\uff0c\u4e3b\u8981\u662f\u901a\u8fc7PyInstaller\u8fd9\u4e2a\u7b2c\u4e09\u65b9\u5e93\u6765\u5b9e\u73b0\u7684\u3002PyInstaller\u662f\u4e00\u4e2a\u53ef\u4ee5\u5c06Python\u7a0b\u5e8f\u6253\u5305\u6210\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u5c06Python\u7a0b\u5e8f\u53ca\u5176\u4f9d\u8d56\u9879\u6253\u5305\u6210\u4e00\u4e2a\u6587\u4ef6\u96c6\u5408\uff0c\u4f7f\u5f97Python\u7a0b\u5e8f\u53ef\u4ee5\u5728\u6ca1\u6709Python\u89e3\u91ca\u5668\u7684\u60c5\u51b5\u4e0b\u8fd0\u884c\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u5c06PaddleOCR\u6253\u5305\u6210exe\u7684\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n<p>1. \u5b89\u88c5PyInstaller<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5PyInstaller\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5728\u7ec8\u7aef\u4e2d\u5b89\u88c5\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>pip install pyinstaller<\/p>\n<p>&#8220;`<\/p>\n<p>2. \u521b\u5efaspec\u6587\u4ef6<\/p>\n<p>\u5728PyInstaller\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u521b\u5efa\u4e00\u4e2aspec\u6587\u4ef6\u6765\u6307\u5b9a\u6211\u4eec\u8981\u6253\u5305\u7684Python\u7a0b\u5e8f\u53ca\u5176\u4f9d\u8d56\u9879\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efaspec\u6587\u4ef6\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>pyinstaller &#8211;name= &#8211;onedir <\/p>\n<p><p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0c&#8220;\u662f\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u7684\u540d\u79f0\uff0c&#8220;\u662f\u8981\u6253\u5305\u7684Python\u7a0b\u5e8f\u7684\u8def\u5f84\u3002<\/p>\n<p><p>\u5728PaddleOCR\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u5c06`paddleocr`\u3001`paddle`\u3001`opencv-python-headless`\u7b49\u4f9d\u8d56\u9879\u5305\u542b\u5728\u6253\u5305\u6587\u4ef6\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efaspec\u6587\u4ef6\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>pyinstaller &#8211;name=paddleocr &#8211;onedir &#8211;hidden-import=paddleocr &#8211;hidden-import=paddleocr.tools &#8211;hidden-import=pa<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/15\/12\/13087263511.jpg\" \/><\/figure>\n<\/p>\n<p>ddleocr.utils &#8211;hidden-import=paddleocr.opencv &#8211;hidden-import=paddleocr.opencv.get_image_file_list &#8211;hidden-import=paddleocr.opencv.get_image_list &#8211;hidden-import=cv2 &#8211;hidden-import=numpy &#8211;hidden-import=argparse &#8211;hidden-import=os &#8211;hidden-import=sys &#8211;hidden-import=glob &#8211;hidden-import=json &#8211;hidden-import=base64 &#8211;hidden-import=requests <\/p>\n<p><p>&#8220;`<\/p>\n<p>\u5728\u4e0a\u8ff0\u547d\u4ee4\u4e2d\uff0c&#8220;\u662fPaddleOCR\u7684Python\u7a0b\u5e8f\u6587\u4ef6\u8def\u5f84\u3002<\/p>\n<p><p>3. \u4fee\u6539spec\u6587\u4ef6<\/p>\n<p>\u521b\u5efaspec\u6587\u4ef6\u540e\uff0c\u6211\u4eec\u9700\u8981\u5bf9\u5176\u8fdb\u884c\u4e00\u4e9b\u4fee\u6539\u4ee5\u786e\u4fdd\u6253\u5305\u6b63\u5e38\u3002\u4e3b\u8981\u4fee\u6539\u4ee5\u4e0b\u51e0\u4e2a\u5730\u65b9\uff1a<\/p>\n<p>\uff081\uff09\u6dfb\u52a0PaddleOCR\u7684\u8d44\u6e90\u8def\u5f84<\/p>\n<p>\u5728spec\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801<a href=\"https:\/\/exe.yimenapp.com\/tool-2141.html\">\u8f6f\u4ef6exe\u5236\u4f5c<\/a>\uff0c\u4ee5\u786e\u4fdd\u6253\u5305\u6587\u4ef6\u4e2d\u5305\u542bPaddleOCR\u7684\u8d44\u6e90\u6587\u4ef6\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>import paddleocr<\/p>\n<p>paddleocr_path = os.path.dirname(paddleocr.__file__)<\/p>\n<p>a = Analysis([&#8221;],<\/p>\n<p><p>             pathex=[&#8221;],<\/p>\n<p><p>             binaries=[],<\/p>\n<p>             datas=[(os.path.join(paddleocr_path, &#8216;dict&#8217;), &#8216;paddleocr\/dict&#8217;),<\/p>\n<p>                    (os.path.join(paddleocr_path, &#8216;ch_ppocr_server_v2.0_rec_infer&#8217;), &#8216;paddleocr\/ch_ppocr_server_v2.0_rec_infer&#8217;),<\/p>\n<p>                    (os.path.join(paddleocr_path, &#8216;ch_ppocr_mobile_v2.0_cls_infer&#8217;), &#8216;paddleocr\/ch_ppocr_mobile_v2.0_cls_infer&#8217;),<\/p>\n<p>                    (os.path.join(paddleocr_path, &#8216;ch_ppocr_mobile_v2.0_det_infer&#8217;), &#8216;paddleocr\/ch_ppocr_mobile_v2.0_det_infer&#8217;),<\/p>\n<p>                    (os.path.join(paddleocr_path, &#8216;ch_ppocr_server_v2.0_cls_infer&#8217;), &#8216;paddleocr\/ch_ppocr_server_v2.0_cls_infer&#8217;),<\/p>\n<p>                    (os.path.join(p<\/p>\n<p> <a href=\"https:\/\/exe.yimenapp.com\/tool-354.html\">\u914d\u7f6e\u73af\u5883\u5982\u4f55\u6253\u5305\u6210\u4e00\u4e2aexe<\/a>       <\/p>\n","protected":false},"excerpt":{"rendered":"<p>PaddleOCR\u662f\u4e00\u4e2a\u57fa\u4e8ePaddlePaddle\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u7684OCR\uff08Optical Character Recognition\uff09\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u6587\u672c\u8bc6\u522b\u3001\u56fe\u50cf\u8bc6\u522b\u7b49\u573a\u666f\u3002\u5728\u4f7f\u7528PaddleOCR<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[6343,17366,982,81,179],"topic":[],"class_list":["post-10509","post","type-post","status-publish","format-standard","hentry","category-ruanjiankf","tag-exe","tag-phpexe","tag-982","tag-81","tag-179"],"_links":{"self":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/10509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/comments?post=10509"}],"version-history":[{"count":0,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/10509\/revisions"}],"wp:attachment":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/media?parent=10509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/categories?post=10509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/tags?post=10509"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/topic?post=10509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}