{"id":429,"date":"2022-10-30T15:27:36","date_gmt":"2022-10-30T07:27:36","guid":{"rendered":"http:\/\/madapapa.com\/wordpress\/?p=429"},"modified":"2022-10-30T16:35:28","modified_gmt":"2022-10-30T08:35:28","slug":"zhong-qiflask1","status":"publish","type":"post","link":"http:\/\/madapapa.com\/wordpress\/?p=429","title":{"rendered":"\u91cd\u542fflask-1"},"content":{"rendered":"<p>\u95f4\u96942-3\u4e2a\u6708\u540e\uff0c\u91cd\u65b0\u5f00\u59cb\u7f16\u7a0b\u906d\u9047\u7684\u6700\u5e38\u89c1\u95ee\u9898\u662f\uff0c\u662f\u73af\u5883\u642d\u5efa<\/p>\n<ul>\n<li>\u6362\u4e00\u53f0\u7535\u8111\uff0c\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u3001python\u4f9d\u8d56\u7684\u73af\u5883\u90fd\u4e0d\u76f8\u540c\uff0c\u6bd4\u5982\u6211\u7684imac\uff0c\u56e0\u4e3a\u786c\u4ef6\u9650\u5236\uff0cmac\u7248\u672c\u5927\u6982\u4f1a\u6c38\u8fdc\u505c\u7559\u5728\u5728Monterey\uff1b<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"http:\/\/madapapa.com\/wordpress\/wp-content\/uploads\/2022\/10\/16671163445143.jpg\" alt=\"\" \/><\/p>\n<ul>\n<li>\u5373\u4f7f\u662f\u66fe\u7ecf\u4f7f\u7528\u987a\u7545\u7684\u8001\u7535\u8111\uff0c\u4e5f\u8bb8\u7ecf\u8fc7\u91cd\u5927\u5347\u7ea7\uff0c\u6bd4\u59822022\u5e7410\u6708\u4e2d\u65ec\u521a\u521a\u53d1\u5e03\u7684macOS-13.0\uff0c\u6216\u8bb8\u662f\u516c\u53f8\u529e\u516c\u7f51\u7edc\u8fdb\u884c\u4e86\u9650\u5236\uff0c\u6ca1\u6cd5\u987a\u5229\u4e0b\u8f7d\u8865\u4e01\uff0c\u4e5f\u4f1a\u906d\u9047\u73af\u5883\u65b9\u9762\u7684\u95ee\u9898\u3002<\/li>\n<\/ul>\n<h2><a id=\"import-tkinter%E9%97%AE%E9%A2%98\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>import_tkinter\u95ee\u9898<\/h2>\n<p>\u9996\u5148\u906d\u9047\u7684\u662ftkinter\u95ee\u9898\uff0c\u5982\u4e0b\u6240\u793a<\/p>\n<pre><code class=\"language-plain_text\">import _tkinter # If this fails your Python may not be configured for Tk\n<\/code><\/pre>\n<p>\u5728stackoverflow\u4e0a\u641c\u7d22\uff0c\u5927\u90e8\u5206\u7b54\u6848\u7ed9\u51fa\u7684\u90fd\u662f\u4f60\u6ca1\u6709\u5b89\u88c5\u597dtkinter\u8fd9\u4e2a\u5e93\uff0c\u89e3\u51b3\u7684\u65b9\u5f0f\u4e5f\u5f88\u7b80\u5355\uff0c\u7528brew\u5b89\u88c5<br \/>\n<img decoding=\"async\" src=\"http:\/\/madapapa.com\/wordpress\/wp-content\/uploads\/2022\/10\/16671173154405.png\" alt=\"\" \/><\/p>\n<p>\u4f46\u662f\u5bf9\u6211\u800c\u8a00\uff0c\u95ee\u9898\u6ca1\u6709\u8fd9\u4e48\u7b80\u5355\uff0c\u56e0\u4e3a\u6211\u6267\u884c\u8fd9\u4e2a\u547d\u4ee4\u540e\uff0c\u51fa\u73b0\u7684\u662f\u65b0\u7684\u9519\u8bef\u63d0\u793a<\/p>\n<pre><code class=\"language-plain_text\">fatal: not in a git directory\nError: Command failed with exit 128: git\n<\/code><\/pre>\n<p>\u53c2\u8003\u4e0b\u9762reference\u91cc\u5c0f\u54e5\u7684\u5206\u6790\uff0c\u8fd9\u662f\u56e0\u4e3ahomebrew\u7684\u7ec4\u4ef6homebrew-core\u548chomebrew-cask\u6ca1\u6709\u88ab\u8bc6\u522b\u4e3aGit\u4ed3\u5e93\u3002<\/p>\n<p>\u89e3\u51b3\u529e\u6cd5\u4e5f\u5f88\u7b80\u5355\uff0c\u76f4\u63a5\u6309\u7167brew\u7684\u63d0\u793a\u5c31\u597d\uff0c\u8f93\u5165<\/p>\n<pre><code class=\"language-plain_text\">brew -v\n<\/code><\/pre>\n<p>\u6309\u7167\u63d0\u793a\u6765\u64cd\u4f5c\u5373\u53ef\uff0c\u5982\u4e0b\u56fe<br \/>\n<img decoding=\"async\" src=\"http:\/\/madapapa.com\/wordpress\/wp-content\/uploads\/2022\/10\/16671178103121.png\" alt=\"\" \/><br \/>\n\u600e\u4e48\uff0c\u8fd8\u662f\u62a5\u9519\uff0c\u56e0\u4e3a\u6211copy\u5982\u4e0a\u547d\u4ee4\u65f6\uff0c\u6ca1\u6709\u53d1\u73b0\u6700\u540e\u4e00\u884c\u5176\u5b9e\u662f\u6ca1\u6709&quot;\/&quot;\u94fe\u63a5\u7684\uff0c\u56e0\u6b64\u4f1a\u51fa\u73b0no such file or directory\u7684\u63d0\u793a\uff0c\u53ea\u8981copy\u6b63\u786e\u7684\u547d\u4ee4\u5373\u53ef<br \/>\n<img decoding=\"async\" src=\"http:\/\/madapapa.com\/wordpress\/wp-content\/uploads\/2022\/10\/16671179897149.png\" alt=\"\" \/><\/p>\n<p>\u4e0b\u6765\uff0c\u5c31\u662f\u6b63\u5e38\u5b89\u88c5<\/p>\n<pre><code class=\"language-plain_text\">brew install python-tk\n<\/code><\/pre>\n<p>\u8fd9\u6837\u5c31\u5b8c\u4e8b\u4e86\u5417\uff0c\u5f53\u7136\u4e0d\u884c\uff0c\u6267\u884cflask run\uff0c\u4e0b\u9762\u62a5\u9519\u6ca1\u6709user\u8fd9\u5f20\u6570\u636e\u5e93\u8868\uff0c\u90a3\u4e48\u663e\u7136\u662f\u6570\u636e\u5e93\u7684\u95ee\u9898\u4e86<br \/>\n<img decoding=\"async\" src=\"http:\/\/madapapa.com\/wordpress\/wp-content\/uploads\/2022\/10\/16671181668653.png\" alt=\"\" \/><\/p>\n<h2><a id=\"%E6%95%B0%E6%8D%AE%E5%BA%93%E9%97%AE%E9%A2%98\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u6570\u636e\u5e93\u95ee\u9898<\/h2>\n<p>\u56e0\u4e3a\u6211\u4eec\u4f7f\u7528\u7684\u662fSQLAlchemy\u7684\u6570\u636e\u5e93\uff0c\u56e0\u6b64\u6211\u4eec\u9700\u8981\u5148\u5efa\u7acb\u4e00\u4e2a\u6570\u636e\u5e93\u6587\u4ef6\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/madapapa.com\/wordpress\/wp-content\/uploads\/2022\/10\/16671187299709.png\" alt=\"\" \/><\/p>\n<p>\u540c\u65f6\uff0c\u6211\u4eec\u4f1a\u5728\u76ee\u5f55\u4e0b\u53d1\u73b0\u4e00\u4e2a\u540d\u4e3adata.db\u7684\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u540d\u79f0\u6765\u81eaapp.py\u4e2d\u7684app.config\u51fd\u6570<\/p>\n<pre><code class=\"language-plain_text\">app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:\/\/\/\/' + os.path.join(app.root_path, 'data.db') \n<\/code><\/pre>\n<h2><a id=\"reference\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>reference<\/h2>\n<p><a href=\"https:\/\/juejin.cn\/post\/7122343112604647437\">Command failed with exit 128:git<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95f4\u96942-3\u4e2a\u6708\u540e\uff0c\u91cd\u65b0\u5f00\u59cb\u7f16\u7a0b\u906d\u9047\u7684\u6700\u5e38\u89c1\u95ee\u9898\u662f\uff0c\u662f\u73af\u5883\u642d\u5efa \u6362\u4e00\u53f0\u7535\u8111\uff0c\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u3001python\u4f9d\u8d56\u7684\u73af\u5883\u90fd\u4e0d\u76f8\u540c\uff0c\u6bd4\u5982\u6211\u7684imac\uff0c\u56e0\u4e3a\u786c\u4ef6\u9650\u5236\uff0cmac\u7248\u672c\u5927\u6982\u4f1a\u6c38\u8fdc\u505c\u7559\u5728\u5728Monterey\uff1b \u5373\u4f7f\u662f\u66fe\u7ecf\u4f7f\u7528\u987a\u7545\u7684\u8001\u7535\u8111\uff0c\u4e5f\u8bb8\u7ecf\u8fc7\u91cd\u5927\u5347\u7ea7\uff0c\u6bd4\u59822022\u5e7410\u6708\u4e2d\u65ec\u521a\u521a\u53d1\u5e03\u7684macOS-13.0\uff0c\u6216\u8bb8\u662f\u516c\u53f8\u529e\u516c\u7f51\u7edc\u8fdb\u884c\u4e86\u9650\u5236\uff0c\u6ca1\u6cd5\u987a\u5229\u4e0b\u8f7d\u8865\u4e01\uff0c\u4e5f\u4f1a\u906d\u9047\u73af\u5883\u65b9\u9762\u7684\u95ee\u9898\u3002 import_tkinter\u95ee\u9898 \u9996\u5148\u906d\u9047\u7684\u662ftkinter\u95ee\u9898\uff0c\u5982\u4e0b\u6240\u793a import _tkinter # If this fails your Python may not be configured for Tk \u5728stackoverflow\u4e0a\u641c\u7d22\uff0c\u5927\u90e8\u5206\u7b54\u6848\u7ed9\u51fa\u7684\u90fd\u662f\u4f60\u6ca1\u6709\u5b89\u88c5\u597dtkinter\u8fd9\u4e2a\u5e93\uff0c\u89e3\u51b3\u7684\u65b9\u5f0f\u4e5f\u5f88\u7b80\u5355\uff0c\u7528brew\u5b89\u88c5 \u4f46\u662f\u5bf9\u6211\u800c\u8a00\uff0c\u95ee\u9898\u6ca1\u6709\u8fd9\u4e48\u7b80\u5355\uff0c\u56e0\u4e3a\u6211\u6267\u884c\u8fd9\u4e2a\u547d\u4ee4\u540e\uff0c\u51fa\u73b0\u7684\u662f\u65b0\u7684\u9519\u8bef\u63d0\u793a fatal: not in a git directory Error: Command failed with exit 128: git \u53c2\u8003\u4e0b\u9762reference\u91cc\u5c0f\u54e5\u7684\u5206\u6790\uff0c\u8fd9\u662f\u56e0\u4e3ahomebrew\u7684\u7ec4\u4ef6homebrew-core\u548chomebrew-cask\u6ca1\u6709\u88ab\u8bc6\u522b\u4e3aGit\u4ed3\u5e93\u3002 \u89e3\u51b3\u529e\u6cd5\u4e5f\u5f88\u7b80\u5355\uff0c\u76f4\u63a5\u6309\u7167brew\u7684\u63d0\u793a\u5c31\u597d\uff0c\u8f93\u5165 brew -v \u6309\u7167\u63d0\u793a\u6765\u64cd\u4f5c\u5373\u53ef\uff0c\u5982\u4e0b\u56fe \u600e\u4e48\uff0c\u8fd8\u662f\u62a5\u9519\uff0c\u56e0\u4e3a\u6211copy\u5982\u4e0a\u547d\u4ee4\u65f6\uff0c\u6ca1\u6709\u53d1\u73b0\u6700\u540e\u4e00\u884c\u5176\u5b9e\u662f\u6ca1\u6709&quot;\/&quot;\u94fe\u63a5\u7684\uff0c\u56e0\u6b64\u4f1a\u51fa\u73b0no such file or directory\u7684\u63d0\u793a\uff0c\u53ea\u8981copy\u6b63\u786e\u7684\u547d\u4ee4\u5373\u53ef \u4e0b\u6765\uff0c\u5c31\u662f\u6b63\u5e38\u5b89\u88c5 brew install python-tk \u8fd9\u6837\u5c31\u5b8c\u4e8b\u4e86\u5417\uff0c\u5f53\u7136\u4e0d\u884c\uff0c\u6267\u884cflask run\uff0c\u4e0b\u9762\u62a5\u9519\u6ca1\u6709user\u8fd9\u5f20\u6570\u636e\u5e93\u8868\uff0c\u90a3\u4e48\u663e\u7136\u662f\u6570\u636e\u5e93\u7684\u95ee\u9898\u4e86 \u6570\u636e\u5e93\u95ee\u9898 \u56e0\u4e3a\u6211\u4eec\u4f7f\u7528\u7684\u662fSQLAlchemy\u7684\u6570\u636e\u5e93\uff0c\u56e0\u6b64\u6211\u4eec\u9700\u8981\u5148\u5efa\u7acb\u4e00\u4e2a\u6570\u636e\u5e93\u6587\u4ef6\u3002 \u540c\u65f6\uff0c\u6211\u4eec\u4f1a\u5728\u76ee\u5f55\u4e0b\u53d1\u73b0\u4e00\u4e2a\u540d\u4e3adata.db\u7684\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u540d\u79f0\u6765\u81eaapp.py\u4e2d\u7684app.config\u51fd\u6570 app.config[&#8216;SQLALCHEMY_DATABASE_URI&#8217;] = &hellip; <a href=\"http:\/\/madapapa.com\/wordpress\/?p=429\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u91cd\u542fflask-1<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[48,44],"tags":[],"class_list":["post-429","post","type-post","status-publish","format-standard","hentry","category-artificial-intelligence","category-flask"],"_links":{"self":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/429","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=429"}],"version-history":[{"count":1,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/429\/revisions"}],"predecessor-version":[{"id":430,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/429\/revisions\/430"}],"wp:attachment":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=429"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}