{"id":641,"date":"2021-08-18T18:59:03","date_gmt":"2021-08-18T10:59:03","guid":{"rendered":"https:\/\/blog.haostudio.net\/hwp\/?p=641"},"modified":"2021-08-31T17:26:28","modified_gmt":"2021-08-31T09:26:28","slug":"py2app-%e5%9c%a8-macos-m1-%e7%94%a2%e7%94%9f-app-%e6%99%82-%e6%89%be%e4%b8%8d%e5%88%b0-init-tcl","status":"publish","type":"post","link":"https:\/\/blog.haostudio.net\/hwp\/py2app-%e5%9c%a8-macos-m1-%e7%94%a2%e7%94%9f-app-%e6%99%82-%e6%89%be%e4%b8%8d%e5%88%b0-init-tcl\/","title":{"rendered":"py2app \u5728 MacOS M1 \u7522\u751f APP \u6642, \u627e\u4e0d\u5230 init.tcl"},"content":{"rendered":"<p>\u5728 MacOS M1 \u7684\u6a5f\u5668\u4e0a, \u7cfb\u7d71\u9810\u8a2d\u7684 python \u4e0d\u5305\u542b tkinter , \u56e0\u6b64\u4f7f\u7528 homebrew \u4f86\u5b89\u88dd tcl-tk \u5957\u4ef6.<br>\n\u4f46\u662f\u5728\u4f7f\u7528 pyvenv \u74b0\u5883\u6642, \u7cfb\u7d71\u4e0d\u6703\u5c07 tcl-tk \u7684 library \u62f7\u8c9d\u5230 venv \u7684 lib \u4e2d.\n<br>\n\u4ee5\u81f3\u65bc py2app \u5728\u5305\u88dd\u6642, \u6703\u907a\u6f0f tcl-tk \u7684 library. \u9020\u6210\u57f7\u884c\u6642\u6703\u627e\u4e0d\u5230 init.tcl \u7684\u554f\u984c\n<br><\/p>\n<!--more-->\n<p>\u56e0\u6b64, \u5fc5\u9808\u624b\u52d5\u5c07 \u4e0b\u5217\u7684 tcl-tk \u7684library \u62f7\u8c9d\u5230 path-to-venv\/lib \u4e2d.\n<br><\/p>\n<pre><code>cd path-to-venv\/lib\ncp -a \/opt\/homebrew\/Cellar\/tcl-tk\/8.6.11\/lib\/tcl8 .\ncp -a \/opt\/homebrew\/Cellar\/tcl-tk\/8.6.11\/lib\/tcl8.6 .\ncp -a \/opt\/homebrew\/Cellar\/tcl-tk\/8.6.11\/lib\/tk8.6 .\n<\/code><\/pre>\n<p>\u82e5\u662f\u4f7f\u7528 MacOS x86\u6a5f\u5668, \u9019\u6642 homebrew \u7684\u8def\u5f91\u9700\u8981\u6539\u6210\u5982\u4e0b:<\/p>\n<pre><code>cd path-to-venv\/lib\ncp -a \/usr\/local\/Cellar\/tcl-tk\/8.6.11_1\/lib\/tcl8 .\ncp -a \/usr\/local\/Cellar\/tcl-tk\/8.6.11_1\/lib\/tcl8.6 .\ncp -a \/usr\/local\/Cellar\/tcl-tk\/8.6.11_1\/lib\/tk8.6 .\n<\/code><\/pre>\n<p><strong>!!\u6ce8\u610f!!<\/strong><\/p>\n<p>\u7531\u65bcMacOS \u672c\u8eab\u6709\u4e5f tcl-tk library, \u4f4d\u65bc\u4e0b\u9762\u8def\u5f91\u4e2d. \u4f46\u662f\u6211\u5011\u662f\u4f7f\u7528 homebrew \u5b89\u88dd\u7684tcl-tk, \u56e0\u6b64\u4e0d\u80fd\u62f7\u8c9d\u4e0b\u9762\u7684 tcl-tk library \u5230 venv \u7684\u74b0\u5883.\n\u4e0d\u7136\u6703\u9020\u6210 app \u51fa\u73fe\u53e6\u4e00\u500b\u932f\u8aa4\u8a0a\u606f(tcl \u7248\u672c\u4e0d\u5408\u7684\u554f\u984c).<\/p>\n<pre><code>\/Library\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/tcl8\n\/Library\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/tcl8.6\n\/Library\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/tk8.6\n<\/code><\/pre>\n<ul>\n<li>\u53c3\u8003\u4f86\u6e90:<a href=\"https:\/\/stackoverflow.com\/questions\/59837456\/send-py2app-application-to-mac-without-python\">Send py2app application to Mac without python<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>\u5728 MacOS M1 \u7684\u6a5f\u5668\u4e0a, \u7cfb\u7d71\u9810\u8a2d\u7684 python \u4e0d\u5305\u542b tkinte &hellip; <a href=\"https:\/\/blog.haostudio.net\/hwp\/py2app-%e5%9c%a8-macos-m1-%e7%94%a2%e7%94%9f-app-%e6%99%82-%e6%89%be%e4%b8%8d%e5%88%b0-init-tcl\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117,114],"tags":[119,118,115],"class_list":["post-641","post","type-post","status-publish","format-standard","hentry","category-macos","category-python","tag-macos","tag-py2app","tag-python"],"_links":{"self":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/comments?post=641"}],"version-history":[{"count":4,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/641\/revisions"}],"predecessor-version":[{"id":651,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/641\/revisions\/651"}],"wp:attachment":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/media?parent=641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/categories?post=641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/tags?post=641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}