{"id":5804,"date":"2023-09-14T15:46:25","date_gmt":"2023-09-14T07:46:25","guid":{"rendered":"https:\/\/www.zhidianwl.net\/zhidianwl\/?p=5804"},"modified":"2023-09-14T15:46:25","modified_gmt":"2023-09-14T07:46:25","slug":"linuxcxfreeze%e6%89%93%e5%8c%85%e6%9c%89%e4%bb%80%e4%b9%88%e4%bc%98%e5%8a%bf","status":"publish","type":"post","link":"https:\/\/www.zhidianwl.net\/zhidianwl\/2023\/09\/14\/linuxcxfreeze%e6%89%93%e5%8c%85%e6%9c%89%e4%bb%80%e4%b9%88%e4%bc%98%e5%8a%bf\/","title":{"rendered":"linuxcxfreeze\u6253\u5305\u6709\u4ec0\u4e48\u4f18\u52bf?"},"content":{"rendered":"

cxfreez\u5f00\u53d1exe\u684c\u9762<\/a>e\u662f\u4e00\u4e2aPython\u7684\u6253\u5305\u5de5\u5177\uff0c\u53ef\u4ee5\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5b83\u53ef\u4ee5\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u5355\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u800c\u4e0d\u9700\u8981\u5b89\u88c5Python\u89e3\u91ca\u5668\u3002cxfreeze\u652f\u6301\u591a\u4e2a\u5e73\u53f0\uff0c\u5305\u62ecWindows\u3001Linux\u3001Mac OS X\u7b49\u3002<\/p>\n

cxfreeze\u7684\u539f\u7406\u662f\u5c06Python\u4ee3\u7801\u8f6c\u6362\u4e3aC\u4ee3\u7801\uff0c\u7136\u540e\u7f16\u8bd1\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5b83\u4f7f\u7528\u4e86Python\u7684\u5185\u7f6e\u6a21\u5757distutils\uff0c\u5c06Python\u4ee3\u7801\u8f6c\u6362\u4e3aC\u4ee3\u7801\uff0c\u7136\u540e\u4f7f\u7528C\u7f16\u8bd1\u5668\u7f16\u8bd1\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n

cxfreeze\u7684\u4f7f\u7528\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

“`<\/p>\n

cxfreeze myscript.py<\/p>\n

“`<\/p>\n

\u5176\u4e2d\uff0cmyscript.py\u662f\u8981\u6253\u5305\u7684Python\u811a\u672c\u3002<\/p>\n

cxfreeze\u8fd8\u652f\u6301\u4e00\u4e9b\u53c2\u6570\uff0c\u53ef\u4ee5\u7528\u6765\u81ea\u5b9a\u4e49\u6253\u5305\u7684\u9009\u9879\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u5355\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n

“`<\/p>\n

cxfreeze myscript.py –target-dir dist –target-name myapp<\/p>\n

“`<\/p>\n

\u5176\u4e2d\uff0c–target-dir\u53c2\u6570\u6307\u5b9a\u4e86\u76ee\u6807\u6587\u4ef6\u5939\uff0c–target-name\u53c2\u6570\u6307\u5b9a\u4e86\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u7684\u540d\u79f0\u3002<\/p>\n

cxfreeze\u8fd8\u652f\u6301\u4e00\u4e9b\u9ad8\u7ea7\u9009\u9879\uff0c\u4f8b\u5982\u53ef\u4ee5\u6307\u5b9a\u9700\u8981\u6253\u5305\u7684Python\u6a21\u5757\u548c\u7b2c\u4e09\u65b9\u5e93\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06Python\u4ee3\u7801\u548c\u7b2c\u4e09\u65b9\u5e93\u6253\u5305\u6210\u5355\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n

“`<\/p>\n

cxfreeze myscript.py –target-dir dist –target-name myapp –include-modules reque\u5e94\u7528\u8f6f\u4ef6\u5c01\u88c5\u6210exe<\/a>sts –packages u<\/p>\n

<\/figure>\n<\/p>\n

rllib3<\/p>\n

“`<\/p>\n

\u5176\u4e2d\uff0c–include-modules\u53c2\u6570\u6307\u5b9a\u4e86\u9700\u8981\u6253\u5305\u7684Python\u6a21\u5757\uff0c–packages\u53c2\u6570\u6307\u5b9a\u4e86\u9700\u8981\u6253\u5305\u7684\u7b2c\u4e09\u65b9\u5e93\u3002<\/p>\n

\u603b\u4e4b\uff0ccxfreeze\u662f\u4e00\u4e2a\u975e\u5e38\u65b9\u4fbf\u7684Python\u6253\u5305\u5de5\u5177\uff0c\u53ef\u4ee5\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u5355\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u65b9\u4fbf\u7528\u6237\u5728\u4e0d\u5b89\u88c5Python\u89e3\u91ca\u5668\u7684\u60c5\u51b5\u4e0b\u8fd0\u884cPython\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

cxfreeze\u662f\u4e00\u4e2aPython\u7684\u6253\u5305\u5de5\u5177\uff0c\u53ef\u4ee5\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5b83\u53ef\u4ee5\u5c06Python\u4ee3\u7801\u6253\u5305\u6210\u5355\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u800c\u4e0d\u9700\u8981\u5b89\u88c5Python\u89e3\u91ca\u5668\u3002cxfreeze\u652f\u6301\u591a\u4e2a\u5e73\u53f0\uff0c\u5305\u62ec<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[9034,38,2793,24,10673],"topic":[],"class_list":["post-5804","post","type-post","status-publish","format-standard","hentry","category-zhuomianruanjian","tag-html5","tag-38","tag-2793","tag-24","tag-exe"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/5804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/comments?post=5804"}],"version-history":[{"count":0,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/5804\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/media?parent=5804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/categories?post=5804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/tags?post=5804"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/topic?post=5804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}