{"id":1075645,"date":"2025-01-08T11:46:06","date_gmt":"2025-01-08T03:46:06","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1075645.html"},"modified":"2025-01-08T11:46:08","modified_gmt":"2025-01-08T03:46:08","slug":"%e7%b3%bb%e7%bb%9f32%e4%bd%8d%e7%9a%84python%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85%e6%96%b9%e6%b3%95-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1075645.html","title":{"rendered":"\u7cfb\u7edf32\u4f4d\u7684python\u5982\u4f55\u5b89\u88c5\u65b9\u6cd5"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24180618\/590970cf-01f7-447e-ae0e-f1a9b36c9b2f.webp\" alt=\"\u7cfb\u7edf32\u4f4d\u7684python\u5982\u4f55\u5b89\u88c5\u65b9\u6cd5\" \/><\/p>\n<p><p> <strong>\u5b89\u88c532\u4f4dPython\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528Python\u5b98\u7f51\u3001Anaconda\u3001\u4ee5\u53ca\u5176\u4ed6\u7b2c\u4e09\u65b9\u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u4e3b\u8981\u7684\u5b89\u88c5\u65b9\u6cd5\uff1a\u4e0b\u8f7d\u5e76\u5b89\u88c532\u4f4dPython\u89e3\u91ca\u5668\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u5b89\u88c5Python\u7684\u5305\u7ba1\u7406\u5de5\u5177pip\u3001\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/strong><\/p>\n<\/p>\n<p><p><strong>\u4e0b\u8f7d\u5e76\u5b89\u88c532\u4f4dPython\u89e3\u91ca\u5668<\/strong>\uff1a\u9996\u5148\uff0c\u4ecePython\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%E4%B8%8B%E8%BD%BD32%E4%BD%8D%E7%89%88%E6%9C%AC%E7%9A%84Python%E3%80%82%E9%80%89%E6%8B%A9%E2%80%9CDownloads%E2%80%9D%E9%80%89%E9%A1%B9%E5%8D%A1%EF%BC%8C%E7%84%B6%E5%90%8E%E9%80%89%E6%8B%A9%E9%80%82%E5%90%88%E4%BD%A0%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%8432%E4%BD%8D%E5%AE%89%E8%A3%85%E7%A8%8B%E5%BA%8F%EF%BC%88%E4%BE%8B%E5%A6%82%EF%BC%8CWindows\">https:\/\/www.python.org\/\uff09\u4e0b\u8f7d32\u4f4d\u7248\u672c\u7684Python\u3002\u9009\u62e9\u201cDownloads\u201d\u9009\u9879\u5361\uff0c\u7136\u540e\u9009\u62e9\u9002\u5408\u4f60\u64cd\u4f5c\u7cfb\u7edf\u768432\u4f4d\u5b89\u88c5\u7a0b\u5e8f\uff08\u4f8b\u5982\uff0cWindows<\/a> x86 executable installer\uff09\u3002\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u786e\u4fdd\u9009\u62e9\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u6837\u53ef\u4ee5\u81ea\u52a8\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4e0b\u8f7d\u5e76\u5b89\u88c532\u4f4dPython\u89e3\u91ca\u5668<\/p>\n<\/p>\n<p><p>1\u3001\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89\">https:\/\/www.python.org\/\uff09<\/a><\/p>\n<\/p>\n<p><p>\u8981\u5b89\u88c532\u4f4dPython\uff0c\u9996\u5148\u9700\u8981\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\u3002\u5728\u7f51\u7ad9\u7684\u201cDownloads\u201d\u9009\u9879\u5361\u4e0b\uff0c\u53ef\u4ee5\u627e\u5230\u9002\u7528\u4e8e\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u7684Python\u5b89\u88c5\u7a0b\u5e8f\u3002\u7531\u4e8e\u4f60\u9700\u8981\u5b89\u88c532\u4f4d\u7248\u672c\u7684Python\uff0c\u786e\u4fdd\u9009\u62e9\u9002\u5f53\u7684\u7248\u672c\u3002\u5bf9\u4e8eWindows\u7528\u6237\uff0c\u53ef\u4ee5\u9009\u62e9\u201cWindows x86 executable installer\u201d\u3002<\/p>\n<\/p>\n<p><p>2\u3001\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f<\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u53cc\u51fb\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002\u5728\u5b89\u88c5\u754c\u9762\u4e2d\uff0c\u6709\u51e0\u4e2a\u9009\u9879\u9700\u8981\u7279\u522b\u6ce8\u610f\u3002\u9996\u5148\uff0c\u786e\u4fdd\u9009\u62e9\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u6837\u53ef\u4ee5\u81ea\u52a8\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4f7f\u5f97Python\u547d\u4ee4\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u4f7f\u7528\u3002\u7136\u540e\uff0c\u70b9\u51fb\u201cCustomize installation\u201d\u6309\u94ae\uff0c\u53ef\u4ee5\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u9009\u9879\u3002\u63a8\u8350\u9009\u62e9\u9ed8\u8ba4\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8c03\u6574\u5b89\u88c5\u8def\u5f84\u548c\u5176\u4ed6\u9009\u9879\u3002<\/p>\n<\/p>\n<p><p>3\u3001\u5b8c\u6210\u5b89\u88c5<\/p>\n<\/p>\n<p><p>\u70b9\u51fb\u201cInstall Now\u201d\u6309\u94ae\uff0c\u5f00\u59cb\u5b89\u88c5Python\u3002\u5b89\u88c5\u8fc7\u7a0b\u901a\u5e38\u4f1a\u6301\u7eed\u51e0\u5206\u949f\uff0c\u5177\u4f53\u65f6\u95f4\u53d6\u51b3\u4e8e\u4f60\u7684\u8ba1\u7b97\u673a\u6027\u80fd\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f1a\u663e\u793a\u4e00\u4e2a\u6210\u529f\u5b89\u88c5\u7684\u63d0\u793a\u9875\u9762\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n<\/p>\n<p><p>1\u3001\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u914d\u7f6e<\/p>\n<\/p>\n<p><p>\u867d\u7136\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9009\u62e9\u4e86\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4f46\u6709\u65f6\u53ef\u80fd\u9700\u8981\u624b\u52a8\u68c0\u67e5\u548c\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08cmd\uff09\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5Python\u662f\u5426\u6b63\u786e\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u663e\u793aPython\u7248\u672c\u4fe1\u606f\uff0c\u8bf4\u660ePython\u5df2\u7ecf\u6b63\u786e\u914d\u7f6e\u3002\u5982\u679c\u6ca1\u6709\u663e\u793a\uff0c\u53ef\u80fd\u9700\u8981\u624b\u52a8\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<p><p>2\u3001\u624b\u52a8\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n<\/p>\n<p><p>\u6253\u5f00\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\uff08\u5728\u201c\u6211\u7684\u7535\u8111\u201d\u6216\u201c\u6b64\u7535\u8111\u201d\u56fe\u6807\u4e0a\u53f3\u952e\u70b9\u51fb\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\uff0c\u7136\u540e\u9009\u62e9\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\uff09\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u90e8\u5206\uff0c\u627e\u5230\u540d\u4e3a\u201cPath\u201d\u7684\u53d8\u91cf\uff0c\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002\u5728\u201c\u7f16\u8f91\u73af\u5883\u53d8\u91cf\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u65b0\u5efa\u201d\uff0c\u7136\u540e\u8f93\u5165Python\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982C:\\Python39\uff09\u3002\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u66f4\u6539\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u5b89\u88c5Python\u7684\u5305\u7ba1\u7406\u5de5\u5177pip<\/p>\n<\/p>\n<p><p>1\u3001\u68c0\u67e5pip\u662f\u5426\u5df2\u5b89\u88c5<\/p>\n<\/p>\n<p><p>\u901a\u5e38\uff0c\u5728\u5b89\u88c5Python\u65f6\u4f1a\u81ea\u52a8\u5b89\u88c5pip\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5pip\u662f\u5426\u5df2\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u663e\u793apip\u7248\u672c\u4fe1\u606f\uff0c\u8bf4\u660epip\u5df2\u7ecf\u6b63\u786e\u5b89\u88c5\u3002\u5982\u679c\u6ca1\u6709\u663e\u793a\uff0c\u53ef\u4ee5\u624b\u52a8\u5b89\u88c5pip\u3002<\/p>\n<\/p>\n<p><p>2\u3001\u624b\u52a8\u5b89\u88c5pip<\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u201cget-pip.py\u201d\u811a\u672c\uff08<a href=\"https:\/\/bootstrap.pypa.io\/get-pip.py%EF%BC%89%E3%80%82%E5%9C%A8%E5%91%BD%E4%BB%A4%E6%8F%90%E7%A4%BA%E7%AC%A6%E4%B8%AD%EF%BC%8C%E5%AF%BC%E8%88%AA%E5%88%B0%E4%B8%8B%E8%BD%BD%E2%80%9Cget-pip.py%E2%80%9D%E8%84%9A%E6%9C%AC%E7%9A%84%E7%9B%AE%E5%BD%95%EF%BC%8C%E7%84%B6%E5%90%8E%E8%BF%90%E8%A1%8C%E4%BB%A5%E4%B8%8B%E5%91%BD%E4%BB%A4%EF%BC%9A\">https:\/\/bootstrap.pypa.io\/get-pip.py\uff09\u3002\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\uff0c\u5bfc\u822a\u5230\u4e0b\u8f7d\u201cget-pip.py\u201d\u811a\u672c\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/a><\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">python get-pip.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5b89\u88c5pip\u5de5\u5177\uff0c\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u518d\u6b21\u68c0\u67e5pip\u7248\u672c\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f<\/p>\n<\/p>\n<p><p>1\u3001\u8fd0\u884cPython\u89e3\u91ca\u5668<\/p>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Python\u89e3\u91ca\u5668\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u663e\u793aPython\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u63d0\u793a\u7b26\uff0c\u8bf4\u660ePython\u5b89\u88c5\u6210\u529f\u3002\u53ef\u4ee5\u8f93\u5165\u4e00\u4e9b\u7b80\u5355\u7684Python\u547d\u4ee4\u8fdb\u884c\u6d4b\u8bd5\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello, World!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>2\u3001\u5b89\u88c5\u6d4b\u8bd5\u5305<\/p>\n<\/p>\n<p><p>\u4f7f\u7528pip\u5b89\u88c5\u4e00\u4e2a\u6d4b\u8bd5\u5305\uff0c\u4f8b\u5982\u201crequests\u201d\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u5728Python\u89e3\u91ca\u5668\u4e2d\u5bfc\u5165\u5e76\u4f7f\u7528\u8be5\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import requests<\/p>\n<p>response = requests.get(&#39;https:\/\/www.python.org&#39;)<\/p>\n<p>print(response.status_code)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u6ca1\u6709\u62a5\u9519\u5e76\u4e14\u663e\u793a\u72b6\u6001\u7801200\uff0c\u8bf4\u660epip\u5de5\u5177\u4e5f\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u5b89\u88c5\u7b2c\u4e09\u65b9\u5de5\u5177<\/p>\n<\/p>\n<p><p>1\u3001\u4f7f\u7528Anaconda<\/p>\n<\/p>\n<p><p>Anaconda\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u6570\u636e\u79d1\u5b66\u548c\u673a\u5668\u5b66\u4e60\u5e73\u53f0\uff0c\u5305\u542b\u4e86Python\u548c\u8bb8\u591a\u5e38\u7528\u7684\u5e93\u3002\u53ef\u4ee5\u4eceAnaconda\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.anaconda.com\/%EF%BC%89%E4%B8%8B%E8%BD%BD32%E4%BD%8D%E7%89%88%E6%9C%AC%E7%9A%84Anaconda%E3%80%82%E5%AE%89%E8%A3%85%E8%BF%87%E7%A8%8B%E7%B1%BB%E4%BC%BC%E4%BA%8EPython%EF%BC%8C%E7%A1%AE%E4%BF%9D%E9%80%89%E6%8B%A9%E2%80%9CAdd\">https:\/\/www.anaconda.com\/\uff09\u4e0b\u8f7d32\u4f4d\u7248\u672c\u7684Anaconda\u3002\u5b89\u88c5\u8fc7\u7a0b\u7c7b\u4f3c\u4e8ePython\uff0c\u786e\u4fdd\u9009\u62e9\u201cAdd<\/a> Anaconda to my PATH environment variable\u201d\u9009\u9879\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528conda\u547d\u4ee4\u7ba1\u7406Python\u73af\u5883\u548c\u5b89\u88c5\u5e93\u3002<\/p>\n<\/p>\n<p><p>2\u3001\u4f7f\u7528Miniconda<\/p>\n<\/p>\n<p><p>Miniconda\u662fAnaconda\u7684\u7cbe\u7b80\u7248\uff0c\u53ea\u5305\u542bconda\u5305\u7ba1\u7406\u5668\u548cPython\u3002\u53ef\u4ee5\u4eceMiniconda\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/docs.conda.io\/en\/latest\/miniconda.html%EF%BC%89%E4%B8%8B%E8%BD%BD32%E4%BD%8D%E7%89%88%E6%9C%AC%E7%9A%84Miniconda%E3%80%82%E5%AE%89%E8%A3%85%E8%BF%87%E7%A8%8B%E4%B8%8EAnaconda%E7%B1%BB%E4%BC%BC%E3%80%82%E5%AE%89%E8%A3%85%E5%AE%8C%E6%88%90%E5%90%8E%EF%BC%8C%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8conda%E5%91%BD%E4%BB%A4%E5%88%9B%E5%BB%BA%E5%92%8C%E7%AE%A1%E7%90%86Python%E7%8E%AF%E5%A2%83%EF%BC%8C%E5%B9%B6%E5%AE%89%E8%A3%85%E6%89%80%E9%9C%80%E7%9A%84%E5%BA%93%E3%80%82\">https:\/\/docs.conda.io\/en\/latest\/miniconda.html\uff09\u4e0b\u8f7d32\u4f4d\u7248\u672c\u7684Miniconda\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e0eAnaconda\u7c7b\u4f3c\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528conda\u547d\u4ee4\u521b\u5efa\u548c\u7ba1\u7406Python\u73af\u5883\uff0c\u5e76\u5b89\u88c5\u6240\u9700\u7684\u5e93\u3002<\/a><\/p>\n<\/p>\n<p><p>\u516d\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<p><p>1\u3001\u521b\u5efa\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<p><p>\u5728\u65e5\u5e38\u5f00\u53d1\u4e2d\uff0c\u5efa\u8bae\u4f7f\u7528\u865a\u62df\u73af\u5883\u6765\u9694\u79bb\u4e0d\u540c\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\u3002\u53ef\u4ee5\u4f7f\u7528venv\u6a21\u5757\u521b\u5efa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">python -m venv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u201cmyenv\u201d\u7684\u865a\u62df\u73af\u5883\u3002\u53ef\u4ee5\u6839\u636e\u9700\u8981\u6307\u5b9a\u5176\u4ed6\u76ee\u5f55\u548c\u540d\u79f0\u3002<\/p>\n<\/p>\n<p><p>2\u3001\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u7684\u65b9\u6cd5\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\u3002\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">myenv\\Scripts\\activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528pip\u5b89\u88c5\u5e93\uff0c\u5e76\u4e14\u8fd9\u4e9b\u5e93\u53ea\u4f1a\u5f71\u54cd\u5f53\u524d\u865a\u62df\u73af\u5883\uff0c\u4e0d\u4f1a\u5f71\u54cd\u5168\u5c40Python\u73af\u5883\u3002<\/p>\n<\/p>\n<p><p>3\u3001\u9000\u51fa\u865a\u62df\u73af\u5883<\/p>\n<\/p>\n<p><p>\u5b8c\u6210\u5de5\u4f5c\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9000\u51fa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">deactivate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e03\u3001\u5b89\u88c5\u548c\u7ba1\u7406\u5e93<\/p>\n<\/p>\n<p><p>1\u3001\u5b89\u88c5\u5e38\u7528\u5e93<\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528pip\u5b89\u88c5\u5e38\u7528\u7684Python\u5e93\uff0c\u4f8b\u5982NumPy\u3001Pandas\u3001Matplotlib\u7b49\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip install numpy pandas matplotlib<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e9b\u5e93\u662f\u6570\u636e\u79d1\u5b66\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u4e2d\u5e38\u7528\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5904\u7406\u6570\u636e\u3001\u8fdb\u884c\u6570\u636e\u5206\u6790\u548c\u53ef\u89c6\u5316\u3002<\/p>\n<\/p>\n<p><p>2\u3001\u7ba1\u7406\u4f9d\u8d56\u5173\u7cfb<\/p>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u4e2d\u4f7f\u7528\u865a\u62df\u73af\u5883\u65f6\uff0c\u5efa\u8bae\u4f7f\u7528requirements.txt\u6587\u4ef6\u6765\u7ba1\u7406\u4f9d\u8d56\u5173\u7cfb\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u751f\u6210requirements.txt\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip freeze &gt; requirements.txt<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u6587\u4ef6\u5305\u542b\u4e86\u5f53\u524d\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u7684\u6240\u6709\u5e93\u53ca\u5176\u7248\u672c\u4fe1\u606f\u3002\u53ef\u4ee5\u5c06\u8fd9\u4e2a\u6587\u4ef6\u63d0\u4ea4\u5230\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u4e2d\uff0c\u65b9\u4fbf\u5176\u4ed6\u5f00\u53d1\u8005\u5b89\u88c5\u76f8\u540c\u7684\u4f9d\u8d56\u3002\u8981\u5b89\u88c5requirements.txt\u6587\u4ef6\u4e2d\u5217\u51fa\u7684\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-cmd\">pip install -r requirements.txt<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u516b\u3001\u4f7f\u7528IDE<\/p>\n<\/p>\n<p><p>1\u3001\u9009\u62e9\u5408\u9002\u7684IDE<\/p>\n<\/p>\n<p><p>Python\u6709\u8bb8\u591a\u4f18\u79c0\u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\uff0c\u4f8b\u5982PyCharm\u3001Visual Studio Code\u3001Jupyter Notebook\u7b49\u3002\u9009\u62e9\u4e00\u4e2a\u9002\u5408\u4f60\u7684IDE\u53ef\u4ee5\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u4ee3\u7801\u8d28\u91cf\u3002<\/p>\n<\/p>\n<p><p>2\u3001\u914d\u7f6eIDE<\/p>\n<\/p>\n<p><p>\u5728IDE\u4e2d\u914d\u7f6ePython\u89e3\u91ca\u5668\u548c\u865a\u62df\u73af\u5883\u3002\u4ee5PyCharm\u4e3a\u4f8b\uff0c\u53ef\u4ee5\u5728\u201cFile\u201d\u83dc\u5355\u4e2d\u9009\u62e9\u201cSettings\u201d\uff0c\u7136\u540e\u5728\u201cProject: <project_name>\u201d\u4e0b\u9009\u62e9\u201cPython Interpreter\u201d\u3002\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684\u9f7f\u8f6e\u56fe\u6807\uff0c\u9009\u62e9\u201cAdd&#8230;\u201d\uff0c\u7136\u540e\u9009\u62e9\u201cExisting environment\u201d\uff0c\u5bfc\u822a\u5230\u865a\u62df\u73af\u5883\u7684Python\u89e3\u91ca\u5668\u8def\u5f84\uff08\u4f8b\u5982myenv\\Scripts\\python.exe\uff09\u3002\u70b9\u51fb\u201cOK\u201d\u4fdd\u5b58\u914d\u7f6e\u3002<\/p>\n<\/p>\n<p><p>3\u3001\u4f7f\u7528IDE\u8fdb\u884c\u5f00\u53d1<\/p>\n<\/p>\n<p><p>\u5728IDE\u4e2d\u521b\u5efa\u548c\u7ba1\u7406Python\u9879\u76ee\uff0c\u7f16\u5199\u548c\u8c03\u8bd5\u4ee3\u7801\u3002\u5927\u591a\u6570IDE\u90fd\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u4f8b\u5982\u4ee3\u7801\u8865\u5168\u3001\u8bed\u6cd5\u68c0\u67e5\u3001\u8c03\u8bd5\u5668\u7b49\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<\/p>\n<p><p>\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u5b89\u88c532\u4f4dPython\u7684\u8fc7\u7a0b\u5305\u62ec\u4e0b\u8f7d\u5e76\u5b89\u88c5Python\u89e3\u91ca\u5668\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u5b89\u88c5pip\u5de5\u5177\u3001\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177\u3001\u521b\u5efa\u548c\u7ba1\u7406\u865a\u62df\u73af\u5883\u3001\u5b89\u88c5\u548c\u7ba1\u7406\u5e93\u4ee5\u53ca\u4f7f\u7528IDE\u8fdb\u884c\u5f00\u53d1\u3002\u901a\u8fc7\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u987a\u5229\u5b89\u88c5\u548c\u4f7f\u752832\u4f4dPython\u8fdb\u884c\u5f00\u53d1\u5de5\u4f5c\u3002\u5e0c\u671b\u8fd9\u7bc7\u6307\u5357\u80fd\u5e2e\u52a9\u4f60\u987a\u5229\u5b89\u88c532\u4f4dPython\uff0c\u5e76\u5f00\u59cb\u4f60\u7684Python\u5f00\u53d1\u4e4b\u65c5\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u786e\u5b9a\u6211\u7684\u7535\u8111\u662f32\u4f4d\u8fd8\u662f64\u4f4d\uff1f<\/strong><br \/>\u8981\u68c0\u67e5\u60a8\u7684\u7535\u8111\u7cfb\u7edf\u662f32\u4f4d\u8fd8\u662f64\u4f4d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u6211\u7684\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002\u5728\u7cfb\u7edf\u4fe1\u606f\u4e2d\uff0c\u60a8\u5c06\u770b\u5230\u201c\u7cfb\u7edf\u7c7b\u578b\u201d\uff0c\u5176\u4e2d\u4f1a\u663e\u793a\u60a8\u5f53\u524d\u7684\u64cd\u4f5c\u7cfb\u7edf\u662f32\u4f4d\u8fd8\u662f64\u4f4d\u3002<\/p>\n<p><strong>\u5b89\u88c532\u4f4dPython\u5bf9\u6211\u7684\u9879\u76ee\u6709\u4ec0\u4e48\u5f71\u54cd\uff1f<\/strong><br \/>\u9009\u62e932\u4f4dPython\u53ef\u80fd\u5bf9\u67d0\u4e9b\u9879\u76ee\u6709\u5f71\u54cd\uff0c\u7279\u522b\u662f\u90a3\u4e9b\u4f9d\u8d56\u4e8e\u7279\u5b9a\u5e93\u6216\u6a21\u5757\u7684\u9879\u76ee\u3002\u5982\u679c\u60a8\u7684\u9879\u76ee\u9700\u8981\u4e0e\u67d0\u4e9b32\u4f4d\u7684\u5e93\u8fdb\u884c\u517c\u5bb9\uff0c\u6216\u8005\u572832\u4f4d\u73af\u5883\u4e0b\u8fd0\u884c\u7684\u8f6f\u4ef6\uff0c\u5b89\u88c532\u4f4dPython\u5c06\u662f\u4e00\u4e2a\u660e\u667a\u7684\u9009\u62e9\u3002\u6b64\u5916\uff0c32\u4f4dPython\u5728\u5185\u5b58\u4f7f\u7528\u4e0a\u6709\u9650\u5236\uff0c\u9002\u5408\u5185\u5b58\u8981\u6c42\u8f83\u4f4e\u7684\u5e94\u7528\u3002<\/p>\n<p><strong>\u5728\u54ea\u4e9b\u60c5\u51b5\u4e0b\u6211\u5e94\u8be5\u9009\u62e9\u5b89\u88c532\u4f4d\u7248\u672c\u7684Python\uff1f<\/strong><br \/>\u5982\u679c\u60a8\u7684\u8ba1\u7b97\u673a\u662f32\u4f4d\u64cd\u4f5c\u7cfb\u7edf\uff0c\u60a8\u5fc5\u987b\u5b89\u88c532\u4f4d\u7248\u672c\u7684Python\u3002\u6b64\u5916\uff0c\u5982\u679c\u60a8\u6b63\u5728\u4f7f\u7528\u4e00\u4e9b\u4ec5\u652f\u630132\u4f4d\u7684\u7b2c\u4e09\u65b9\u5e93\uff0c\u6216\u8005\u5f00\u53d1\u9700\u8981\u517c\u5bb932\u4f4d\u7cfb\u7edf\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u9009\u62e932\u4f4dPython\u4e5f\u662f\u5408\u7406\u7684\u9009\u62e9\u3002\u6b64\u5916\uff0c\u67d0\u4e9b\u8001\u65e7\u7684\u7cfb\u7edf\u6216\u8f6f\u4ef6\u73af\u5883\u53ef\u80fd\u66f4\u9002\u5408\u4f7f\u752832\u4f4d\u7248\u672c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5b89\u88c532\u4f4dPython\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528Python\u5b98\u7f51\u3001Anaconda\u3001\u4ee5\u53ca\u5176\u4ed6\u7b2c\u4e09\u65b9\u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u4e3b\u8981 [&hellip;]","protected":false},"author":3,"featured_media":1075653,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1075645"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1075645"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1075645\/revisions"}],"predecessor-version":[{"id":1075655,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1075645\/revisions\/1075655"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1075653"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1075645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1075645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1075645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}