{"id":850,"date":"2025-01-11T11:43:32","date_gmt":"2025-01-11T03:43:32","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=850"},"modified":"2025-01-11T11:43:32","modified_gmt":"2025-01-11T03:43:32","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8pycharm%e4%b8%ad%e9%85%8d%e7%bd%aepython%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83%ef%bc%9a%e8%af%a6%e7%bb%86%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/01\/11\/%e5%a6%82%e4%bd%95%e5%9c%a8pycharm%e4%b8%ad%e9%85%8d%e7%bd%aepython%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83%ef%bc%9a%e8%af%a6%e7%bb%86%e6%95%99%e7%a8%8b\/","title":{"rendered":"\u5982\u4f55\u5728PyCharm\u4e2d\u914d\u7f6ePython\u5f00\u53d1\u73af\u5883\uff1a\u8be6\u7ec6\u6559\u7a0b"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u5728 PyCharm \u4e2d\u914d\u7f6e Python \u73af\u5883\u975e\u5e38\u91cd\u8981\uff0c\u56e0\u4e3a\u5b83\u80fd\u591f\u786e\u4fdd\u4f60\u5728\u4e00\u4e2a\u5e72\u51c0\u4e14\u9694\u79bb\u7684\u73af\u5883\u4e2d\u5f00\u53d1\uff0c\u907f\u514d\u9879\u76ee\u4e4b\u95f4\u7684\u4f9d\u8d56\u51b2\u7a81\u3002\u4e0b\u9762\u662f\u914d\u7f6e Python \u73af\u5883\u7684\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">\u6b65\u9aa4 1\uff1a\u5b89\u88c5 PyCharm<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86 PyCharm\u3002\u5982\u679c\u5c1a\u672a\u5b89\u88c5\uff0c\u53ef\u4ee5\u4ece <a href=\"https:\/\/www.jetbrains.com\/pycharm\/\">PyCharm\u5b98\u7f51<\/a> \u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6b65\u9aa4 2\uff1a\u521b\u5efa\u65b0\u9879\u76ee\u6216\u6253\u5f00\u73b0\u6709\u9879\u76ee<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u521b\u5efa\u65b0\u9879\u76ee<\/strong>\uff1a\u542f\u52a8 PyCharm \u540e\uff0c\u9009\u62e9 <code>Create New Project<\/code> \u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\u76ee\u3002<\/li>\n\n\n\n<li><strong>\u6253\u5f00\u73b0\u6709\u9879\u76ee<\/strong>\uff1a\u5982\u679c\u4f60\u5df2\u7ecf\u6709\u4e86\u4e00\u4e2a\u9879\u76ee\uff0c\u53ef\u4ee5\u9009\u62e9 <code>Open<\/code> \u6253\u5f00\u8be5\u9879\u76ee\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u6b65\u9aa4 3\uff1a\u9009\u62e9 Python \u89e3\u91ca\u5668<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bcf\u4e2a PyCharm \u9879\u76ee\u90fd\u9700\u8981\u4e00\u4e2a Python \u89e3\u91ca\u5668\u3002\u89e3\u91ca\u5668\u53ef\u4ee5\u662f\u7cfb\u7edf Python \u6216\u865a\u62df\u73af\u5883\u4e2d\u7684 Python\u3002\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u9879\u76ee\u914d\u7f6e\u72ec\u7acb\u7684 Python \u73af\u5883\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u914d\u7f6e\u65b9\u6cd5 1\uff1a\u4e3a\u65b0\u9879\u76ee\u9009\u62e9 Python \u89e3\u91ca\u5668<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u9009\u62e9 Python \u89e3\u91ca\u5668<\/strong>\uff1a<br>\u5728\u521b\u5efa\u65b0\u9879\u76ee\u7684\u8fc7\u7a0b\u4e2d\uff0cPyCharm \u4f1a\u63d0\u793a\u4f60\u9009\u62e9\u4e00\u4e2a Python \u89e3\u91ca\u5668\u3002\u5982\u679c\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86 Python\uff0cPyCharm \u4f1a\u81ea\u52a8\u68c0\u6d4b\u7cfb\u7edf\u4e2d\u7684 Python \u89e3\u91ca\u5668\u3002<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5728 &#8220;Project Interpreter&#8221; \u680f\u4e2d\uff0c\u9009\u62e9\u4f60\u60f3\u8981\u7684 Python \u89e3\u91ca\u5668\u3002\u5982\u679c\u4f60\u5c1a\u672a\u5b89\u88c5 Python\uff0cPyCharm \u63d0\u4f9b\u4e86\u4e0b\u8f7d\u548c\u5b89\u88c5 Python \u7684\u9009\u9879\u3002<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u9009\u62e9\u865a\u62df\u73af\u5883<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u4f60\u60f3\u4e3a\u8be5\u9879\u76ee\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u73af\u5883\uff0c\u53ef\u4ee5\u9009\u62e9 &#8220;New environment&#8221; \u9009\u9879\uff08\u63a8\u8350\u7528\u4e8e\u907f\u514d\u4f9d\u8d56\u51b2\u7a81\uff09\u3002<\/li>\n\n\n\n<li>\u9009\u62e9 <code>Virtualenv<\/code> \u6216 <code>Conda<\/code> \u4f5c\u4e3a\u73af\u5883\u7ba1\u7406\u5de5\u5177\u3002<\/li>\n\n\n\n<li>\u70b9\u51fb <code>Create<\/code> \u521b\u5efa\u865a\u62df\u73af\u5883\u5e76\u5c06\u5176\u5206\u914d\u7ed9\u5f53\u524d\u9879\u76ee\u3002<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">\u914d\u7f6e\u65b9\u6cd5 2\uff1a\u4e3a\u73b0\u6709\u9879\u76ee\u914d\u7f6e Python \u89e3\u91ca\u5668<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u4f60\u5df2\u7ecf\u6253\u5f00\u4e86\u4e00\u4e2a\u73b0\u6709\u9879\u76ee\uff0c\u5e76\u4e14\u5e0c\u671b\u4fee\u6539\u6216\u9009\u62e9\u4e0d\u540c\u7684\u89e3\u91ca\u5668\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u6253\u5f00\u8bbe\u7f6e<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u70b9\u51fb PyCharm \u7a97\u53e3\u53f3\u4e0a\u89d2\u7684 <code>File<\/code>\uff08Windows\uff09\u6216 <code>PyCharm<\/code>\uff08macOS\uff09\uff0c\u9009\u62e9 <code>Settings<\/code>\uff08Windows\uff09\u6216 <code>Preferences<\/code>\uff08macOS\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u8bbf\u95ee Python \u89e3\u91ca\u5668\u8bbe\u7f6e<\/strong>\uff1a<br>\u5728\u5f39\u51fa\u7684\u8bbe\u7f6e\u7a97\u53e3\u4e2d\uff0c\u5bfc\u822a\u5230 <code>Project: &lt;Your Project Name><\/code> > <code>Python Interpreter<\/code>\u3002<\/li>\n\n\n\n<li><strong>\u9009\u62e9\u6216\u6dfb\u52a0\u89e3\u91ca\u5668<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u4f60\u5df2\u6709 Python \u89e3\u91ca\u5668\u5217\u8868\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684\u9f7f\u8f6e\u56fe\u6807\uff0c\u9009\u62e9 <code>Add...<\/code>\u3002<\/li>\n\n\n\n<li>\u4f60\u53ef\u4ee5\u9009\u62e9\uff1a\n<ul class=\"wp-block-list\">\n<li><strong>System Interpreter<\/strong>\uff1a\u9009\u62e9\u7cfb\u7edf\u4e2d\u5df2\u5b89\u88c5\u7684 Python\u3002<\/li>\n\n\n\n<li><strong>Virtualenv<\/strong>\uff1a\u521b\u5efa\u65b0\u7684\u865a\u62df\u73af\u5883\u6216\u9009\u62e9\u73b0\u6709\u7684\u865a\u62df\u73af\u5883\u3002<\/li>\n\n\n\n<li><strong>Conda Environment<\/strong>\uff1a\u5982\u679c\u4f60\u4f7f\u7528 Anaconda \u7ba1\u7406\u73af\u5883\uff0c\u53ef\u4ee5\u9009\u62e9 Conda \u73af\u5883\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u521b\u5efa\u65b0\u7684\u865a\u62df\u73af\u5883<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u70b9\u51fb <code>Virtualenv Environment<\/code> \u9009\u9879\u5361\uff0c\u7136\u540e\u9009\u62e9 <code>New environment<\/code>\u3002<\/li>\n\n\n\n<li>PyCharm \u4f1a\u81ea\u52a8\u9009\u62e9\u865a\u62df\u73af\u5883\u7684\u8def\u5f84\u3002\u4f60\u53ef\u4ee5\u4fee\u6539\u8def\u5f84\uff0c\u4e5f\u53ef\u4ee5\u63a5\u53d7\u9ed8\u8ba4\u8def\u5f84\u3002<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u786e\u8ba4\u5e76\u5e94\u7528<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u9009\u62e9\u597d\u89e3\u91ca\u5668\u540e\uff0c\u70b9\u51fb <code>OK<\/code> \u786e\u8ba4\u8bbe\u7f6e\uff0cPyCharm \u4f1a\u5f00\u59cb\u4f7f\u7528\u9009\u5b9a\u7684 Python \u73af\u5883\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u6b65\u9aa4 4\uff1a\u5b89\u88c5\u9879\u76ee\u4f9d\u8d56<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u914d\u7f6e\u597d Python \u89e3\u91ca\u5668\u540e\uff0c\u9879\u76ee\u4f9d\u8d56\uff08\u5982 <code>requests<\/code>, <code>numpy<\/code> \u7b49\u5e93\uff09\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u5b89\u88c5\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u901a\u8fc7 PyCharm \u7684 UI \u5b89\u88c5\u4f9d\u8d56<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5728 <code>Settings<\/code> > <code>Project: &lt;Project Name><\/code> > <code>Python Interpreter<\/code> \u9875\u9762\uff0c\u4f60\u4f1a\u770b\u5230\u5f53\u524d\u73af\u5883\u7684\u5e93\u5217\u8868\u3002<\/li>\n\n\n\n<li>\u70b9\u51fb\u53f3\u4e0b\u89d2\u7684 <code>+<\/code> \u56fe\u6807\uff0c\u641c\u7d22\u5e76\u5b89\u88c5\u9700\u8981\u7684\u5e93\u3002<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u901a\u8fc7\u547d\u4ee4\u884c\u5b89\u88c5<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f60\u53ef\u4ee5\u901a\u8fc7 PyCharm \u5185\u7f6e\u7684\u7ec8\u7aef\uff08Terminal\uff09\u76f4\u63a5\u4f7f\u7528 <code>pip<\/code> \u6216 <code>conda<\/code> \u5b89\u88c5\u4f9d\u8d56\u3002<\/li>\n\n\n\n<li>\u6253\u5f00 PyCharm \u5e95\u90e8\u7684 <code>Terminal<\/code> \u6807\u7b7e\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<br><code>bash pip install &lt;package-name><\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u6b65\u9aa4 5\uff1a\u9a8c\u8bc1\u914d\u7f6e<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u68c0\u67e5 Python \u7248\u672c<\/strong>\uff1a\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff0c\u9a8c\u8bc1\u5f53\u524d\u73af\u5883\u7684 Python \u7248\u672c\uff1a<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   python --version<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u68c0\u67e5\u5df2\u5b89\u88c5\u7684\u5e93<\/strong>\uff1a\u4f7f\u7528 <code>pip list<\/code> \u547d\u4ee4\u6765\u5217\u51fa\u5f53\u524d\u865a\u62df\u73af\u5883\u4e2d\u5df2\u5b89\u88c5\u7684\u5e93\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u5c0f\u8d34\u58eb\uff1a<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528\u865a\u62df\u73af\u5883\u80fd\u591f\u6709\u6548\u5730\u907f\u514d\u9879\u76ee\u95f4\u4f9d\u8d56\u51b2\u7a81\uff0c\u63a8\u8350\u5728\u6bcf\u4e2a\u9879\u76ee\u4e2d\u90fd\u521b\u5efa\u72ec\u7acb\u7684\u865a\u62df\u73af\u5883\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u4f60\u7684\u9879\u76ee\u4f9d\u8d56\u591a\u4e2a\u73af\u5883\uff08\u4f8b\u5982\uff0c\u591a\u4e2a Python \u7248\u672c\u6216 Conda \u73af\u5883\uff09\uff0c\u53ef\u4ee5\u4f7f\u7528 PyCharm \u7684 <code>Project Interpreter<\/code> \u7ba1\u7406\u8fd9\u4e9b\u73af\u5883\u3002<\/li>\n\n\n\n<li>\u914d\u7f6e\u5b8c\u6210\u540e\uff0cPyCharm \u4f1a\u81ea\u52a8\u5c06\u5f53\u524d\u9879\u76ee\u7684\u89e3\u91ca\u5668\u4e0e\u4ee3\u7801\u3001\u8fd0\u884c\u914d\u7f6e\u7b49\u7ed1\u5b9a\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u4f60\u5c31\u53ef\u4ee5\u8f7b\u677e\u5730\u5728 PyCharm \u4e2d\u914d\u7f6e\u548c\u7ba1\u7406 Python \u73af\u5883\uff0c\u786e\u4fdd\u5f00\u53d1\u8fc7\u7a0b\u987a\u5229\u8fdb\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 PyCharm \u4e2d\u914d\u7f6e Python \u73af\u5883\u975e\u5e38\u91cd\u8981\uff0c\u56e0\u4e3a\u5b83\u80fd\u591f\u786e\u4fdd\u4f60\u5728\u4e00\u4e2a\u5e72\u51c0\u4e14\u9694\u79bb\u7684\u73af\u5883\u4e2d\u5f00\u53d1\uff0c\u907f\u514d\u9879\u76ee [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[],"class_list":["post-850","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=850"}],"version-history":[{"count":1,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/850\/revisions"}],"predecessor-version":[{"id":851,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/850\/revisions\/851"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}