{"id":5413,"date":"2022-04-02T20:58:13","date_gmt":"2022-04-02T12:58:13","guid":{"rendered":"https:\/\/egonlin.com\/?p=5413"},"modified":"2022-04-02T20:58:13","modified_gmt":"2022-04-02T12:58:13","slug":"05-04-%e6%a8%a1%e5%9d%974-pyinstaller%e5%ba%93%e7%9a%84%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=5413","title":{"rendered":"05-04 \u6a21\u57574-pyinstaller\u5e93\u7684\u4f7f\u7528"},"content":{"rendered":"<h1>\u4e00\u3001PyInstaller\u5e93\u57fa\u672c\u4ecb\u7ecd<\/h1>\n<h2>1.1 PyInstaller\u5e93\u6982\u8ff0<\/h2>\n<p>\u5c06.py\u6e90\u4ee3\u7801\u8f6c\u6362\u6210\u65e0\u9700\u6e90\u4ee3\u7801\u7684\u53ef\u6267\u884c\u6587\u4ef6<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/pyinstaller\u5e93\u7684\u4f7f\u75281.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/pyinstaller\u5e93\u7684\u4f7f\u75281.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<p>PyInstaller\u5e93\u662f\u7b2c\u4e09\u65b9\u5e93<\/p>\n<ul>\n<li>\u5b98\u65b9\u7f51\u7ad9\uff1a<a href=\"http:\/\/www.pyinstaller.org\/\">http:\/\/www.pyinstaller.org<\/a><\/li>\n<li>\u7b2c\u4e09\u65b9\u5e93\uff1a\u4f7f\u7528\u524d\u9700\u8981\u989d\u5916\u5b89\u88c5<\/li>\n<li>\u5b89\u88c5\u7b2c\u4e09\u65b9\u5e93\u9700\u8981\u4f7f\u7528pip\u5de5\u5177<\/li>\n<\/ul>\n<h2>1.2 pip\u7684\u4f7f\u7528<\/h2>\n<h2>1.3 pip install pyinstaller (cmd\u547d\u4ee4\u884c)<\/h2>\n<pre><code>pip install pyinstaller<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/pyinstaller\u5e93\u7684\u4f7f\u75282.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/pyinstaller\u5e93\u7684\u4f7f\u75282.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h1>\u4e8c\u3001PyInstaller\u5e93\u4f7f\u7528\u8bf4\u660e<\/h1>\n<h2>2.1 \u7b80\u5355\u7684\u4f7f\u7528<\/h2>\n<p>(cmd\u547d\u4ee4\u884c) <code>pyinstaller -F &lt;\u6587\u4ef6\u540d.py&gt;<\/code><\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/pyinstaller\u5e93\u7684\u4f7f\u75283.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/pyinstaller\u5e93\u7684\u4f7f\u75283.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h2>2.2 PyInstaller\u5e93\u5e38\u7528\u53c2\u6570<\/h2>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u53c2\u6570<\/th>\n<th style=\"text-align: center;\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">-h<\/td>\n<td style=\"text-align: center;\">\u67e5\u770b\u5e2e\u52a9<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">&#8211;clean<\/td>\n<td style=\"text-align: center;\">\u6e05\u7406\u6253\u5305\u8fc7\u7a0b\u4e2d\u7684\u4e34\u65f6\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">-D,&#8211;onedir<\/td>\n<td style=\"text-align: center;\">\u9ed8\u8ba4\u503c\uff0c\u751f\u6210sist\u6587\u4ef6\u5939<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">-F,&#8211;onefile<\/td>\n<td style=\"text-align: center;\">\u5728dist\u6587\u4ef6\u5939\u4e2d\u53ea\u751f\u6210\u72ec\u7acb\u7684\u6253\u5305\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">-i &lt;\u56fe\u6807\u6587\u4ef6\u540d.ico&gt;<\/td>\n<td style=\"text-align: center;\">\u6307\u5b9a\u6253\u5305\u7a0b\u5e8f\u4f7f\u7528\u7684\u56fe\u6807(icon)\u6587\u4ef6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>2.3 \u4f7f\u7528\u4e3e\u4f8b<\/h2>\n<pre><code>pyinstaller \u2013i curve.ico \u2013F SevenDigitsDrawV2.py<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/pyinstaller\u5e93\u7684\u4f7f\u75284.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/pyinstaller\u5e93\u7684\u4f7f\u75284.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001PyInstaller\u5e93\u57fa\u672c\u4ecb\u7ecd 1.1 PyInstaller\u5e93\u6982\u8ff0 \u5c06.py\u6e90\u4ee3\u7801\u8f6c\u6362\u6210\u65e0\u9700\u6e90\u4ee3\u7801\u7684\u53ef [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":5414,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[371,376],"tags":[],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/5413"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5413"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/5413\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/media\/5414"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}