{"id":1187367,"date":"2025-01-15T20:04:26","date_gmt":"2025-01-15T12:04:26","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1187367.html"},"modified":"2025-01-15T20:04:29","modified_gmt":"2025-01-15T12:04:29","slug":"%e7%94%b5%e8%84%91%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bd%bdpython3-7","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1187367.html","title":{"rendered":"\u7535\u8111\u5982\u4f55\u4e0b\u8f7dpython3.7"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25135938\/a3873f70-5132-4d82-84a4-b794569191d9.webp\" alt=\"\u7535\u8111\u5982\u4f55\u4e0b\u8f7dpython3.7\" \/><\/p>\n<p><p> <strong>\u7535\u8111\u4e0b\u8f7dPython3.7\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u8bbf\u95eePython\u5b98\u7f51\u3001\u9009\u62e9\u9002\u5408\u7684\u7248\u672c\u3001\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/strong>\u3002\u5176\u4e2d\uff0c\u6700\u8be6\u7ec6\u7684\u6b65\u9aa4\u662f\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u8fd9\u4e00\u6b65\u662f\u786e\u4fdd\u4f60\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u65b9\u4fbf\u5730\u4f7f\u7528Python\u3002\u5177\u4f53\u64cd\u4f5c\u4e3a\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u8fdb\u5165\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u5e76\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u4e2d\u627e\u5230\u5e76\u9009\u62e9\u201cPath\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002<\/li>\n<li>\u5728\u7f16\u8f91\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u65b0\u5efa\u201d\uff0c\u5c06Python\u5b89\u88c5\u8def\u5f84\uff08\u5982C:\\Python37\uff09\u548cScripts\u8def\u5f84\uff08\u5982C:\\Python37\\Scripts\uff09\u6dfb\u52a0\u8fdb\u53bb\u3002<\/li>\n<li>\u786e\u5b9a\u5e76\u4fdd\u5b58\u66f4\u6539\u3002<\/li>\n<\/ol>\n<p><p>\u63a5\u4e0b\u6765\u6211\u4eec\u5c06\u8be6\u7ec6\u8bb2\u89e3\u4e0b\u8f7d\u548c\u914d\u7f6ePython3.7\u7684\u6574\u4e2a\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u8bbf\u95eePython\u5b98\u7f51<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6253\u5f00\u4f60\u7684\u7f51\u7edc\u6d4f\u89c8\u5668\u5e76\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff1a<a href=\"https:\/\/www.python.org%E3%80%82\">https:\/\/www.python.org\u3002<\/a><\/p>\n<\/p>\n<p><h4>\u9009\u62e9\u5408\u9002\u7684\u7248\u672c<\/h4>\n<\/p>\n<p><p>\u5728Python\u5b98\u7f51\u9996\u9875\uff0c\u627e\u5230\u201cDownloads\u201d\u83dc\u5355\uff0c\u5e76\u70b9\u51fb\u5b83\u3002\u5728\u4e0b\u62c9\u83dc\u5355\u4e2d\u9009\u62e9\u201cWindows\u201d\uff0c\u8fd9\u4f1a\u5e26\u4f60\u5230\u4e00\u4e2a\u9875\u9762\uff0c\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684Python\u7248\u672c\u3002\u5728\u8fd9\u4e2a\u9875\u9762\u4e2d\uff0c\u627e\u5230Python3.7\u7684\u7248\u672c\uff08\u4f8b\u5982Python 3.7.9\uff09\uff0c\u7136\u540e\u70b9\u51fb\u5b83\u8fdb\u5165\u4e0b\u8f7d\u9875\u9762\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4e0b\u8f7dPython3.7<\/h3>\n<\/p>\n<p><p>\u8fdb\u5165\u4e0b\u8f7d\u9875\u9762\u540e\uff0c\u4f60\u4f1a\u770b\u5230\u4e00\u4e2a\u540d\u4e3a\u201cFiles\u201d\u7684\u90e8\u5206\uff0c\u5176\u4e2d\u5217\u51fa\u4e86\u591a\u4e2a\u5b89\u88c5\u5305\u3002\u5bf9\u4e8e\u5927\u591a\u6570Windows\u7528\u6237\u6765\u8bf4\uff0c\u9009\u62e9\u201cWindows x86-64 executable installer\u201d\u662f\u6700\u5408\u9002\u7684\u3002\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f32\u4f4d\u7684Windows\u7cfb\u7edf\uff0c\u90a3\u4e48\u9009\u62e9\u201cWindows x86 executable installer\u201d\u3002<\/p>\n<\/p>\n<p><h4>\u5f00\u59cb\u4e0b\u8f7d<\/h4>\n<\/p>\n<p><p>\u70b9\u51fb\u9002\u5408\u4f60\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u5305\u94fe\u63a5\uff0c\u6d4f\u89c8\u5668\u4f1a\u5f00\u59cb\u4e0b\u8f7d\u8fd9\u4e2a\u6587\u4ef6\u3002\u6839\u636e\u4f60\u7684\u7f51\u7edc\u901f\u5ea6\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u51e0\u5206\u949f\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u5b89\u88c5Python3.7<\/h3>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u627e\u5230\u4f60\u4e0b\u8f7d\u7684\u6587\u4ef6\uff0c\u5e76\u53cc\u51fb\u8fd0\u884c\u5b83\u3002\u5b89\u88c5\u7a0b\u5e8f\u4f1a\u542f\u52a8\uff0c\u5e76\u663e\u793a\u4e00\u4e2a\u5b89\u88c5\u5411\u5bfc\u3002<\/p>\n<\/p>\n<p><h4>\u5b89\u88c5\u5411\u5bfc\u8bbe\u7f6e<\/h4>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u5411\u5bfc\u7684\u7b2c\u4e00\u4e2a\u9875\u9762\uff0c\u786e\u4fdd\u9009\u4e2d\u201cAdd Python 3.7 to PATH\u201d\u9009\u9879\uff0c\u8fd9\u4e00\u6b65\u975e\u5e38\u91cd\u8981\uff0c\u56e0\u4e3a\u5b83\u4f1a\u81ea\u52a8\u4e3a\u4f60\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u7136\u540e\u70b9\u51fb\u201cInstall Now\u201d\u6309\u94ae\uff0c\u5f00\u59cb\u5b89\u88c5Python 3.7\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u5c3d\u7ba1\u5728\u5b89\u88c5\u65f6\u5df2\u7ecf\u9009\u62e9\u4e86\u201cAdd Python 3.7 to PATH\u201d\u9009\u9879\uff0c\u5efa\u8bae\u624b\u52a8\u68c0\u67e5\u548c\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u786e\u4fdd\u4e00\u5207\u6b63\u5e38\u3002<\/p>\n<\/p>\n<p><h4>\u68c0\u67e5\u73af\u5883\u53d8\u91cf<\/h4>\n<\/p>\n<ol>\n<li>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u8fdb\u5165\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u5e76\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u4e2d\u627e\u5230\u5e76\u9009\u62e9\u201cPath\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002<\/li>\n<\/ol>\n<p><h4>\u6dfb\u52a0Python\u8def\u5f84<\/h4>\n<\/p>\n<p><p>\u5728\u7f16\u8f91\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u65b0\u5efa\u201d\uff0c\u5c06Python\u5b89\u88c5\u8def\u5f84\uff08\u5982C:\\Python37\uff09\u548cScripts\u8def\u5f84\uff08\u5982C:\\Python37\\Scripts\uff09\u6dfb\u52a0\u8fdb\u53bb\u3002\u786e\u4fdd\u6bcf\u4e2a\u8def\u5f84\u5728\u4e00\u884c\u4e2d\u3002<\/p>\n<\/p>\n<p><h4>\u4fdd\u5b58\u8bbe\u7f6e<\/h4>\n<\/p>\n<p><p>\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u6309\u94ae\uff0c\u5173\u95ed\u6240\u6709\u5bf9\u8bdd\u6846\u4ee5\u4fdd\u5b58\u66f4\u6539\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u9a8c\u8bc1\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08\u6309Win+R\u952e\uff0c\u8f93\u5165cmd\uff0c\u6309\u56de\u8f66\uff09\uff0c\u7136\u540e\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5Python\u662f\u5426\u5b89\u88c5\u6210\u529f\u5e76\u914d\u7f6e\u6b63\u786e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u663e\u793a\u201cPython 3.7.x\u201d\uff0c\u5219\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u5b89\u88c5pip\u548c\u5176\u4ed6\u5de5\u5177<\/h3>\n<\/p>\n<p><p>Python3.7\u81ea\u5e26pip\uff0c\u8fd9\u662fPython\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u7528\u4e8e\u5b89\u88c5\u548c\u7ba1\u7406Python\u5e93\u548c\u5305\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1pip\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679cpip\u5df2\u7ecf\u5b89\u88c5\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u5b89\u88c5\u5176\u4ed6Python\u5305\uff0c\u4f8b\u5982NumPy\u3001Pandas\u7b49\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5\u4e00\u4e2a\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install package_name<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u5b89\u88c5\u5e38\u7528\u7684Python\u5e93<\/h3>\n<\/p>\n<p><h4>NumPy<\/h4>\n<\/p>\n<p><p>NumPy\u662f\u4e00\u4e2a\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u7684\u5e93\uff0c\u63d0\u4f9b\u4e86\u652f\u6301\u5927\u89c4\u6a21\u591a\u7ef4\u6570\u7ec4\u548c\u77e9\u9635\u8fd0\u7b97\u7684\u529f\u80fd\u3002\u5b89\u88c5NumPy\u7684\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install numpy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>Pandas<\/h4>\n<\/p>\n<p><p>Pandas\u662f\u4e00\u4e2a\u7528\u4e8e\u6570\u636e\u64cd\u4f5c\u548c\u5206\u6790\u7684\u5e93\uff0c\u63d0\u4f9b\u4e86\u6570\u636e\u7ed3\u6784\u548c\u6570\u636e\u5206\u6790\u5de5\u5177\u3002\u5b89\u88c5Pandas\u7684\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install pandas<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>Matplotlib<\/h4>\n<\/p>\n<p><p>Matplotlib\u662f\u4e00\u4e2a\u7528\u4e8e\u7ed8\u5236\u56fe\u8868\u7684\u5e93\uff0c\u652f\u6301\u591a\u79cd\u56fe\u8868\u7c7b\u578b\u3002\u5b89\u88c5Matplotlib\u7684\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install matplotlib<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516b\u3001\u4f7f\u7528IDE\u8fdb\u884c\u5f00\u53d1<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u597dPython\u4e4b\u540e\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u4e00\u4e2a\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u6765\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002\u5e38\u7528\u7684IDE\u5305\u62ecPyCharm\u3001VSCode\u548cJupyter Notebook\u3002<\/p>\n<\/p>\n<p><h4>\u5b89\u88c5PyCharm<\/h4>\n<\/p>\n<p><p>PyCharm\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684Python IDE\uff0c\u63d0\u4f9b\u4e86\u4ee3\u7801\u7f16\u8f91\u3001\u8c03\u8bd5\u548c\u6d4b\u8bd5\u529f\u80fd\u3002\u4f60\u53ef\u4ee5\u4eceJetBrains\u5b98\u7f51\uff08<a href=\"https:\/\/www.jetbrains.com\/pycharm\/%EF%BC%89%E4%B8%8B%E8%BD%BD%E5%B9%B6%E5%AE%89%E8%A3%85PyCharm%E3%80%82\">https:\/\/www.jetbr<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>ns.com\/pycharm\/\uff09\u4e0b\u8f7d\u5e76\u5b89\u88c5PyCharm\u3002<\/a><\/p>\n<\/p>\n<p><h4>\u5b89\u88c5VSCode<\/h4>\n<\/p>\n<p><p>VSCode\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\uff0c\u5305\u62ecPython\u3002\u4f60\u53ef\u4ee5\u4eceVSCode\u5b98\u7f51\uff08<a href=\"https:\/\/code.visualstudio.com\/%EF%BC%89%E4%B8%8B%E8%BD%BD%E5%B9%B6%E5%AE%89%E8%A3%85VSCode%E3%80%82%E5%AE%89%E8%A3%85%E5%AE%8C%E6%88%90%E5%90%8E%EF%BC%8C%E9%80%9A%E8%BF%87VSCode%E7%9A%84%E6%89%A9%E5%B1%95%E5%B8%82%E5%9C%BA%E5%AE%89%E8%A3%85Python%E6%89%A9%E5%B1%95%E3%80%82\">https:\/\/code.visualstudio.com\/\uff09\u4e0b\u8f7d\u5e76\u5b89\u88c5VSCode\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u901a\u8fc7VSCode\u7684\u6269\u5c55\u5e02\u573a\u5b89\u88c5Python\u6269\u5c55\u3002<\/a><\/p>\n<\/p>\n<p><h4>\u5b89\u88c5Jupyter Notebook<\/h4>\n<\/p>\n<p><p>Jupyter Notebook\u662f\u4e00\u4e2a\u57fa\u4e8eWeb\u7684\u4ea4\u4e92\u5f0f\u5f00\u53d1\u73af\u5883\uff0c\u9002\u5408\u6570\u636e\u5206\u6790\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7pip\u5b89\u88c5Jupyter Notebook\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install jupyter<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Jupyter Notebook\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">jupyter notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e5d\u3001\u7f16\u5199\u7b2c\u4e00\u4e2aPython\u7a0b\u5e8f<\/h3>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u5b8c\u6210\u6240\u6709\u5de5\u5177\u548c\u5e93\u4e4b\u540e\uff0c\u4f60\u53ef\u4ee5\u5f00\u59cb\u7f16\u5199\u4f60\u7684\u7b2c\u4e00\u4e2aPython\u7a0b\u5e8f\u3002\u6253\u5f00\u4f60\u9009\u62e9\u7684IDE\u6216\u7f16\u8f91\u5668\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u6587\u4ef6\uff08\u4f8b\u5982hello.py\uff09\uff0c\u5e76\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello, Python 3.7!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u6587\u4ef6\uff0c\u7136\u540e\u8fd0\u884c\u5b83\u3002\u5982\u679c\u770b\u5230\u201cHello, Python 3.7!\u201d\u7684\u8f93\u51fa\uff0c\u606d\u559c\u4f60\uff0c\u4f60\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u5e76\u914d\u7f6e\u4e86Python 3.7\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u3001\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<\/p>\n<p><h4>\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9047\u5230\u7684\u95ee\u9898<\/h4>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002\u4f8b\u5982\uff0c\u65e0\u6cd5\u4e0b\u8f7d\u6587\u4ef6\u3001\u5b89\u88c5\u5931\u8d25\u7b49\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u65e0\u6cd5\u4e0b\u8f7d\u6587\u4ef6<\/strong>\uff1a\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\uff0c\u5c1d\u8bd5\u4f7f\u7528\u5176\u4ed6\u6d4f\u89c8\u5668\u6216\u4e0b\u8f7d\u5de5\u5177\u3002<\/li>\n<li><strong>\u5b89\u88c5\u5931\u8d25<\/strong>\uff1a\u786e\u4fdd\u4e0b\u8f7d\u7684\u6587\u4ef6\u5b8c\u6574\u4e14\u65e0\u635f\uff0c\u5c1d\u8bd5\u91cd\u65b0\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002<\/li>\n<\/ol>\n<p><h4>\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u95ee\u9898<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u65e0\u6cd5\u8bc6\u522bPython\u547d\u4ee4\uff0c\u53ef\u80fd\u662f\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u95ee\u9898\u3002\u786e\u4fdd\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u4e2d\u6b63\u786e\u6dfb\u52a0\u4e86Python\u5b89\u88c5\u8def\u5f84\u548cScripts\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h4>pip\u5b89\u88c5\u5305\u5931\u8d25<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5728\u4f7f\u7528pip\u5b89\u88c5\u5305\u65f6\u9047\u5230\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5347\u7ea7pip<\/strong>\uff1a\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5347\u7ea7pip\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">python -m pip install --upgrade pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u56fd\u5185\u955c\u50cf\u6e90<\/strong>\uff1a\u7531\u4e8e\u67d0\u4e9b\u539f\u56e0\uff0c\u53ef\u80fd\u65e0\u6cd5\u4ece\u5b98\u65b9\u6e90\u4e0b\u8f7d\u5305\u3002\u53ef\u4ee5\u4f7f\u7528\u56fd\u5185\u955c\u50cf\u6e90\uff0c\u5982\u963f\u91cc\u4e91\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install package_name -i https:\/\/mirrors.aliyun.com\/pypi\/simple\/<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u5341\u4e00\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u5728\u5f00\u53d1\u591a\u4e2aPython\u9879\u76ee\u65f6\uff0c\u4f7f\u7528\u865a\u62df\u73af\u5883\u53ef\u4ee5\u907f\u514d\u5305\u7248\u672c\u51b2\u7a81\u3002Python3.7\u81ea\u5e26\u4e86venv\u6a21\u5757\uff0c\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u865a\u62df\u73af\u5883\u3002<\/p>\n<\/p>\n<p><h4>\u521b\u5efa\u865a\u62df\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u76ee\u5f55\u4e2d\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">python -m venv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4f1a\u5728\u9879\u76ee\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a\u540d\u4e3amyenv\u7684\u6587\u4ef6\u5939\uff0c\u5176\u4e2d\u5305\u542b\u72ec\u7acb\u7684Python\u89e3\u91ca\u5668\u548cpip\u3002<\/p>\n<\/p>\n<p><h4>\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/h4>\n<\/p>\n<p><p>\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-shell\">myenv\\Scripts\\activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u547d\u4ee4\u63d0\u793a\u7b26\u4f1a\u663e\u793a\u865a\u62df\u73af\u5883\u7684\u540d\u79f0\uff0c\u8fd9\u65f6\u4f60\u53ef\u4ee5\u5728\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u548c\u7ba1\u7406\u5305\u3002<\/p>\n<\/p>\n<p><h4>\u9000\u51fa\u865a\u62df\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9000\u51fa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">deactivate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5341\u4e8c\u3001Python3.7\u7684\u4e3b\u8981\u7279\u6027<\/h3>\n<\/p>\n<p><p>Python3.7\u5f15\u5165\u4e86\u4e00\u4e9b\u65b0\u7684\u7279\u6027\u548c\u6539\u8fdb\uff0c\u5305\u62ec\u6570\u636e\u7c7b\u3001\u4e0a\u4e0b\u6587\u53d8\u91cf\u3001\u65f6\u95f4\u51fd\u6570\u7cbe\u5ea6\u6539\u8fdb\u7b49\u3002<\/p>\n<\/p>\n<p><h4>\u6570\u636e\u7c7b<\/h4>\n<\/p>\n<p><p>\u6570\u636e\u7c7b\uff08dataclasses\uff09\u662fPython3.7\u5f15\u5165\u7684\u4e00\u79cd\u65b0\u7684\u7c7b\u5b9a\u4e49\u65b9\u5f0f\uff0c\u7528\u4e8e\u7b80\u5316\u6570\u636e\u5bf9\u8c61\u7684\u521b\u5efa\u3002\u4f7f\u7528dataclasses\u6a21\u5757\uff0c\u53ef\u4ee5\u81ea\u52a8\u751f\u6210init\u3001repr\u7b49\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from dataclasses import dataclass<\/p>\n<p>@dataclass<\/p>\n<p>class Point:<\/p>\n<p>    x: int<\/p>\n<p>    y: int<\/p>\n<p>p = Point(1, 2)<\/p>\n<p>print(p)  # \u8f93\u51fa\uff1aPoint(x=1, y=2)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u4e0a\u4e0b\u6587\u53d8\u91cf<\/h4>\n<\/p>\n<p><p>\u4e0a\u4e0b\u6587\u53d8\u91cf\uff08contextvars\uff09\u6a21\u5757\u63d0\u4f9b\u4e86\u4e00\u79cd\u7ba1\u7406\u4e0a\u4e0b\u6587\u6570\u636e\u7684\u65b9\u5f0f\uff0c\u9002\u7528\u4e8e\u5f02\u6b65\u7f16\u7a0b\u548c\u591a\u7ebf\u7a0b\u73af\u5883\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import contextvars<\/p>\n<p>var = contextvars.ContextVar(&#39;var&#39;)<\/p>\n<p>def func():<\/p>\n<p>    var.set(&#39;value&#39;)<\/p>\n<p>    print(var.get())  # \u8f93\u51fa\uff1avalue<\/p>\n<p>func()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5341\u4e09\u3001\u4f7f\u7528pipenv\u8fdb\u884c\u4f9d\u8d56\u7ba1\u7406<\/h3>\n<\/p>\n<p><p>pipenv\u662f\u4e00\u4e2a\u66f4\u9ad8\u7ea7\u7684\u4f9d\u8d56\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u81ea\u52a8\u521b\u5efa\u548c\u7ba1\u7406\u865a\u62df\u73af\u5883\uff0c\u540c\u65f6\u7b80\u5316\u5305\u7684\u5b89\u88c5\u548c\u7ba1\u7406\u3002<\/p>\n<\/p>\n<p><h4>\u5b89\u88c5pipenv<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5pipenv\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install pipenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u521b\u5efa\u548c\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u76ee\u5f55\u4e2d\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u548c\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pipenv install<\/p>\n<p>pipenv shell<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u5b89\u88c5\u5305<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pipenv install package_name<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>pipenv\u4f1a\u81ea\u52a8\u66f4\u65b0Pipfile\u548cPipfile.lock\u6587\u4ef6\uff0c\u8bb0\u5f55\u9879\u76ee\u7684\u4f9d\u8d56\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u56db\u3001Python3.7\u4e2d\u7684\u5176\u4ed6\u6539\u8fdb<\/h3>\n<\/p>\n<p><p>Python3.7\u8fd8\u5f15\u5165\u4e86\u4e00\u4e9b\u6027\u80fd\u6539\u8fdb\u548c\u65b0\u7684\u8bed\u6cd5\u7279\u6027\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><h4>\u6027\u80fd\u6539\u8fdb<\/h4>\n<\/p>\n<p><p>Python3.7\u7684\u5b57\u5178\u5b9e\u73b0\u4f7f\u7528\u4e86\u65b0\u7684\u54c8\u5e0c\u8868\u7b97\u6cd5\uff0c\u4f7f\u5f97\u5b57\u5178\u7684\u6027\u80fd\u6709\u6240\u63d0\u5347\u3002\u540c\u65f6\uff0cPython3.7\u7684\u542f\u52a8\u65f6\u95f4\u4e5f\u6709\u6240\u7f29\u77ed\u3002<\/p>\n<\/p>\n<p><h4>\u65b0\u7684\u8bed\u6cd5\u7279\u6027<\/h4>\n<\/p>\n<p><p>Python3.7\u5f15\u5165\u4e86\u4e00\u4e9b\u65b0\u7684\u8bed\u6cd5\u7279\u6027\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u5ef6\u8fdf\u8bc4\u4f30\u7c7b\u578b\u6ce8\u91ca<\/strong>\uff1a\u5141\u8bb8\u5728\u7c7b\u578b\u6ce8\u91ca\u4e2d\u4f7f\u7528\u672a\u6765\u5f15\u7528\uff0c\u4ee5\u907f\u514d\u5faa\u73af\u5bfc\u5165\u95ee\u9898\u3002<\/li>\n<li><strong>\u5f02\u6b65\u751f\u6210\u5668\u548c\u5f02\u6b65\u63a8\u5bfc\u5f0f<\/strong>\uff1a\u652f\u6301\u5f02\u6b65\u751f\u6210\u5668\u51fd\u6570\u548c\u5f02\u6b65\u63a8\u5bfc\u5f0f\u3002<\/li>\n<\/ol>\n<p><h3>\u5341\u4e94\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u672c\u6587\uff0c\u4f60\u5df2\u7ecf\u4e86\u89e3\u4e86\u5982\u4f55\u5728\u7535\u8111\u4e0a\u4e0b\u8f7d\u5e76\u5b89\u88c5Python3.7\uff0c\u4ee5\u53ca\u5982\u4f55\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u5b89\u88c5\u5e38\u7528\u5e93\u548c\u4f7f\u7528IDE\u8fdb\u884c\u5f00\u53d1\u3002\u540c\u65f6\uff0c\u6211\u4eec\u8fd8\u4ecb\u7ecd\u4e86Python3.7\u7684\u4e00\u4e9b\u65b0\u7279\u6027\u548c\u6539\u8fdb\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u80fd\u5e2e\u52a9\u4f60\u987a\u5229\u5f00\u59cbPython3.7\u7684\u5b66\u4e60\u548c\u5f00\u53d1\u4e4b\u65c5\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684Python\u7248\u672c\u8fdb\u884c\u4e0b\u8f7d\uff1f<\/strong><br \/>\u5728\u4e0b\u8f7dPython\u65f6\uff0c\u9009\u62e9\u5408\u9002\u7684\u7248\u672c\u975e\u5e38\u91cd\u8981\u3002Python 3.7\u662f\u4e00\u4e2a\u7a33\u5b9a\u7684\u7248\u672c\uff0c\u9002\u5408\u8bb8\u591a\u9879\u76ee\u548c\u5e93\u7684\u4f7f\u7528\u3002\u5982\u679c\u60a8\u662f\u65b0\u624b\uff0c\u5efa\u8bae\u4ece\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7dPython\u7684\u6700\u65b0\u7248\u672c\uff0c\u4ee5\u786e\u4fdd\u83b7\u5f97\u6700\u65b0\u7684\u529f\u80fd\u548c\u5b89\u5168\u66f4\u65b0\u3002\u8003\u8651\u60a8\u7684\u64cd\u4f5c\u7cfb\u7edf\u7c7b\u578b\uff08Windows\u3001macOS\u3001Linux\uff09\u4ee5\u53ca\u60a8\u9700\u8981\u517c\u5bb9\u7684\u5e93\u6216\u6846\u67b6\u3002<\/p>\n<p><strong>\u4e0b\u8f7dPython 3.7\u7684\u6b65\u9aa4\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u8981\u4e0b\u8f7dPython 3.7\uff0c\u60a8\u53ef\u4ee5\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u7684\u4e0b\u8f7d\u9875\u9762\u3002\u9009\u62e9\u9002\u5408\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u5305\uff0c\u901a\u5e38\u4f1a\u6709Windows\u3001macOS\u548cLinux\u7248\u672c\u3002\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff0c\u5e76\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u4ee5\u9009\u62e9\u6dfb\u52a0Python\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u65b9\u4fbf\u5730\u4f7f\u7528\u3002<\/p>\n<p><strong>\u5728\u5b89\u88c5Python\u540e\u5982\u4f55\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\uff1f<\/strong><br \/>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u662f\u4e00\u4e2a\u91cd\u8981\u6b65\u9aa4\u3002\u5728\u547d\u4ee4\u884c\uff08Windows\u4e0b\u4e3acmd\uff0cmacOS\u548cLinux\u4e0b\u4e3a\u7ec8\u7aef\uff09\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\uff0c\u60a8\u5e94\u8be5\u80fd\u770b\u5230Python 3.7\u7684\u7248\u672c\u4fe1\u606f\u3002\u5982\u679c\u51fa\u73b0\u7248\u672c\u53f7\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002\u5982\u679c\u672a\u80fd\u627e\u5230Python\uff0c\u53ef\u80fd\u9700\u8981\u68c0\u67e5\u5b89\u88c5\u8def\u5f84\u6216\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u7535\u8111\u4e0b\u8f7dPython3.7\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u8bbf\u95eePython\u5b98\u7f51\u3001\u9009\u62e9\u9002\u5408\u7684\u7248\u672c\u3001\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u5176\u4e2d\uff0c\u6700 [&hellip;]","protected":false},"author":3,"featured_media":1187372,"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\/1187367"}],"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=1187367"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1187367\/revisions"}],"predecessor-version":[{"id":1187374,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1187367\/revisions\/1187374"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1187372"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1187367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1187367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1187367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}