{"id":20583,"date":"2024-11-19T14:05:02","date_gmt":"2024-11-19T06:05:02","guid":{"rendered":"https:\/\/fwq.ai\/blog\/20583\/"},"modified":"2024-11-19T14:05:02","modified_gmt":"2024-11-19T06:05:02","slug":"%e6%80%8e%e4%b9%88%e5%9c%a8sublime%e4%b8%ad%e5%ae%89%e8%a3%85pygame","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/20583\/","title":{"rendered":"\u600e\u4e48\u5728sublime\u4e2d\u5b89\u88c5pygame"},"content":{"rendered":"<blockquote><p>\n  \u5728 sublime text \u4e2d\u5b89\u88c5 pygame \u7684\u6b65\u9aa4\uff1a\u786e\u4fdd\u5df2\u5b89\u88c5 python 3\u3002\u4f7f\u7528 pip \u5b89\u88c5 pip\u3002\u4f7f\u7528 pip \u5b89\u88c5 pygame\u3002\u5c06 pygame \u8def\u5f84\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u3002\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/03\/2024040306481949369.jpg\" class=\"aligncenter\" title=\"\u600e\u4e48\u5728sublime\u4e2d\u5b89\u88c5pygame\u63d2\u56fe\" alt=\"\u600e\u4e48\u5728sublime\u4e2d\u5b89\u88c5pygame\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Sublime Text \u4e2d\u5b89\u88c5 Pygame<\/strong><\/p>\n<p>Pygame \u662f\u4e00\u4e2a\u7528\u4e8e\u521b\u5efa 2D \u6e38\u620f\u7684 Python \u5e93\u3002\u8981\u5728 Sublime Text \u4e2d\u5b89\u88c5 Pygame\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<p><strong>1. \u5b89\u88c5 Python<\/strong><\/p>\n<p>\u786e\u4fdd\u5df2\u5b89\u88c5 Python 3\u3002\u60a8\u53ef\u4ee5\u4ece\u5b98\u65b9 Python \u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002<\/p>\n<p><strong>2. \u5b89\u88c5 pip<\/strong><\/p>\n<p>pip \u662f Python \u7684\u5305\u7ba1\u7406\u7cfb\u7edf\u3002\u5982\u679c\u8fd8\u672a\u5b89\u88c5\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<pre>python -m ensurepip --upgrade<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u4f7f\u7528 pip \u5b89\u88c5 Pygame<\/strong><\/p>\n<p>\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u5e76\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5 Pygame\uff1a<\/p>\n<pre>pip install pygame<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u5c06 Pygame \u8def\u5f84\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<p>\u73b0\u5728\u9700\u8981\u5c06 Pygame \u7684\u5b89\u88c5\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u8fd9\u6837 Sublime Text \u624d\u80fd\u627e\u5230\u5b83\u3002\u5728 Windows \u4e2d\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<ul>\n<li>\u53f3\u952e\u5355\u51fb &#8220;\u6b64\u7535\u8111&#8221; \u5e76\u9009\u62e9 &#8220;\u5c5e\u6027&#8221;\u3002<\/li>\n<li>\u5355\u51fb &#8220;\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e&#8221;\uff0c\u7136\u540e\u5728 &#8220;\u73af\u5883\u53d8\u91cf&#8221; \u4e0b\u5355\u51fb &#8220;\u8def\u5f84&#8221;\u3002<\/li>\n<li>\u5728 &#8220;\u53d8\u91cf\u503c&#8221; \u4e0b\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u8def\u5f84\uff08\u6839\u636e\u60a8\u7684 Python \u5b89\u88c5\u4f4d\u7f6e\u8fdb\u884c\u8c03\u6574\uff09\uff1a<\/li>\n<\/ul>\n<pre>C:Python3Libsite-packages<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728 macOS \u548c Linux \u4e2d\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<ul>\n<li>\u6253\u5f00\u7ec8\u7aef\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ul>\n<pre>export PYTHONPATH=$PYTHONPATH:\/Library\/Frameworks\/Python.framework\/Versions\/3.7\/lib\/python3.7\/site-packages<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\uff08\u6839\u636e\u60a8\u7684 Python \u5b89\u88c5\u4f4d\u7f6e\u8c03\u6574\u7248\u672c\u53f7\uff09<\/p>\n<p><strong>5. \u9a8c\u8bc1\u5b89\u88c5<\/strong><\/p>\n<p>\u6253\u5f00 Sublime Text\uff0c\u6309 Ctrl + ~\uff08Windows\uff09\u6216 Cmd + ~\uff08macOS\uff09\u6253\u5f00\u63a7\u5236\u53f0\u3002\u7136\u540e\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>import pygame\npygame.init()\n\nprint(pygame.get_init())<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u8f93\u51fa\u4e3a [True, True, True, True, True, True, True, True, True, True, True, True]\uff0c\u5219\u8868\u660e Pygame \u5df2\u6210\u529f\u5b89\u88c5\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5728\u4e2d\u5b89\u88c5pygame\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 sublime text \u4e2d\u5b89\u88c5 pygame \u7684\u6b65\u9aa4\uff1a\u786e\u4fdd\u5df2\u5b89\u88c5 python 3\u3002\u4f7f\u7528 pip \u5b89\u88c5 pip\u3002\u4f7f\u7528 pip \u5b89\u88c5 pygame\u3002\u5c06 pygame \u8def\u5f84\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u3002\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002 \u5982\u4f55\u5728 Sublime Text \u4e2d\u5b89\u88c5 Pygame Pygame \u662f\u4e00\u4e2a\u7528\u4e8e\u521b\u5efa 2D \u6e38\u620f\u7684 Python \u5e93\u3002\u8981\u5728 Sublime Text \u4e2d\u5b89\u88c5 Pygame\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a 1. \u5b89\u88c5 Python \u786e\u4fdd\u5df2\u5b89\u88c5 Python 3\u3002\u60a8\u53ef\u4ee5\u4ece\u5b98\u65b9 Python \u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002 2. \u5b89\u88c5 pip pip \u662f Python \u7684\u5305\u7ba1\u7406\u7cfb\u7edf\u3002\u5982\u679c\u8fd8\u672a\u5b89\u88c5\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a python -m ensurepip &#8211;upgrade \u767b\u5f55\u540e\u590d\u5236 3. \u4f7f\u7528 pip \u5b89\u88c5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-20583","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=20583"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20583\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=20583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=20583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=20583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}