{"id":983545,"date":"2024-12-27T07:20:24","date_gmt":"2024-12-26T23:20:24","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/983545.html"},"modified":"2024-12-27T07:20:28","modified_gmt":"2024-12-26T23:20:28","slug":"python%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85%e5%88%ab%e7%9a%84%e7%9b%98","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/983545.html","title":{"rendered":"python\u5982\u4f55\u5b89\u88c5\u522b\u7684\u76d8"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24211538\/35b89179-971c-49ff-bc0b-f8e5978d30de.webp\" alt=\"python\u5982\u4f55\u5b89\u88c5\u522b\u7684\u76d8\" \/><\/p>\n<p><p> <strong>\u8981\u5728\u5176\u4ed6\u76d8\u5b89\u88c5Python\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a\u4e0b\u8f7dPython\u5b89\u88c5\u7a0b\u5e8f\u3001\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u3001\u9009\u62e9\u76ee\u6807\u5b89\u88c5\u8def\u5f84\u3002\u5728\u6b64\u57fa\u7840\u4e0a\uff0c\u786e\u4fdd\u5c06\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/strong> \u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5176\u4e2d\u4e00\u4e2a\u6b65\u9aa4\u2014\u2014\u9009\u62e9\u76ee\u6807\u5b89\u88c5\u8def\u5f84\uff1a<\/p>\n<\/p>\n<p><p>\u5728\u5b89\u88c5Python\u65f6\uff0c\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u9009\u9879\uff08Customize installation\uff09\uff0c\u7136\u540e\u5728\u201cOptional Features\u201d\u9875\u9762\uff0c\u70b9\u51fb\u201cNext\u201d\u6309\u94ae\uff0c\u63a5\u7740\u5728\u201cAdvanced Options\u201d\u9875\u9762\u4e2d\uff0c\u52fe\u9009\u201cCustomize install location\u201d\u9009\u9879\u3002\u5728\u4e0b\u65b9\u7684\u6587\u672c\u6846\u4e2d\u8f93\u5165\u6216\u6d4f\u89c8\u9009\u62e9\u4f60\u5e0c\u671b\u5b89\u88c5Python\u7684\u76ee\u6807\u8def\u5f84\uff0c\u6bd4\u5982\u201cD:\\Python\u201d\uff0c\u8fd9\u6837Python\u5c06\u4f1a\u88ab\u5b89\u88c5\u5230D\u76d8\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e00\u3001\u4e0b\u8f7dPython\u5b89\u88c5\u7a0b\u5e8f<\/h3>\n<\/p>\n<p><p>Python\u7684\u5b98\u65b9\u7f51\u7ad9\u63d0\u4f9b\u4e86\u6700\u65b0\u7248\u672c\u7684Python\u5b89\u88c5\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u9009\u62e9\u9002\u5408\u7684\u7248\u672c\u4e0b\u8f7d\u3002\u8bbf\u95ee<a href=\"https:\/\/www.python.org\/downloads\/\">Python\u5b98\u7f51<\/a>\u5e76\u4e0b\u8f7d\u6700\u65b0\u7684\u5b89\u88c5\u7a0b\u5e8f\u3002\u5728\u4e0b\u8f7d\u9875\u9762\u4e0a\uff0c\u4f60\u53ef\u4ee5\u770b\u5230\u4e0d\u540c\u7248\u672c\u7684Python\u4ee5\u53ca\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u517c\u5bb9\u7684\u7248\u672c\uff0c\u786e\u4fdd\u9009\u62e9\u9002\u5408\u4f60\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b89\u88c5\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<p><p>\u5728\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u627e\u5230\u4e0b\u8f7d\u6587\u4ef6\u5939\u4e2d\u7684\u5b89\u88c5\u7a0b\u5e8f\uff0c\u53cc\u51fb\u4ee5\u542f\u52a8\u5b89\u88c5\u3002\u5b89\u88c5\u7a0b\u5e8f\u7684\u7528\u6237\u754c\u9762\u5c06\u4f1a\u6253\u5f00\uff0c\u51c6\u5907\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u542f\u52a8\u5b89\u88c5\u7a0b\u5e8f\u540e\uff0c\u9996\u5148\u4f1a\u770b\u5230\u4e00\u4e2a\u6b22\u8fce\u9875\u9762\u3002\u5728\u8fd9\u91cc\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u9ed8\u8ba4\u5b89\u88c5\u6216\u81ea\u5b9a\u4e49\u5b89\u88c5\u3002\u4e3a\u4e86\u5728\u5176\u4ed6\u76d8\u4e0a\u5b89\u88c5Python\uff0c\u6211\u4eec\u9700\u8981\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u3002\u70b9\u51fb\u201cCustomize installation\u201d\u6309\u94ae\uff0c\u8fdb\u5165\u4e0b\u4e00\u4e2a\u9875\u9762\u3002<\/p>\n<\/p>\n<p><p>\u5728\u201cOptional Features\u201d\u9875\u9762\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u5b89\u88c5\u7684\u529f\u80fd\u6a21\u5757\u3002\u5efa\u8bae\u52fe\u9009\u6240\u6709\u53ef\u9009\u529f\u80fd\uff0c\u4ee5\u786e\u4fdd\u5b8c\u6574\u5b89\u88c5Python\uff0c\u5c24\u5176\u662f\u201cpip\u201d\uff0c\u8fd9\u662fPython\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u5c06\u5728\u540e\u7eed\u5b89\u88c5\u5176\u4ed6\u5e93\u65f6\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u9009\u62e9\u76ee\u6807\u5b89\u88c5\u8def\u5f84<\/h3>\n<\/p>\n<p><p>\u5728\u201cAdvanced Options\u201d\u9875\u9762\uff0c\u52fe\u9009\u201cCustomize install location\u201d\u9009\u9879\u3002\u8fd9\u4e00\u6b65\u975e\u5e38\u5173\u952e\uff0c\u56e0\u4e3a\u5b83\u5141\u8bb8\u4f60\u6307\u5b9aPython\u7684\u5b89\u88c5\u76ee\u5f55\u3002\u5728\u4e0b\u65b9\u7684\u6587\u672c\u6846\u4e2d\u8f93\u5165\u6216\u6d4f\u89c8\u9009\u62e9\u4f60\u5e0c\u671b\u5b89\u88c5Python\u7684\u76ee\u6807\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u5e0c\u671b\u5c06Python\u5b89\u88c5\u5728D\u76d8\uff0c\u53ef\u4ee5\u8f93\u5165\u201cD:\\Python\u201d\u4f5c\u4e3a\u5b89\u88c5\u8def\u5f84\u3002\u786e\u4fdd\u76ee\u6807\u8def\u5f84\u6709\u8db3\u591f\u7684\u53ef\u7528\u7a7a\u95f4\uff0c\u5e76\u4e14\u4f60\u6709\u6743\u9650\u5728\u8be5\u4f4d\u7f6e\u5b89\u88c5\u8f6f\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u5728\u547d\u4ee4\u884c\u4e2d\u65b9\u4fbf\u5730\u4f7f\u7528Python\uff0c\u6211\u4eec\u9700\u8981\u5c06Python\u7684\u5b89\u88c5\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u5728\u201cAdvanced Options\u201d\u9875\u9762\uff0c\u6709\u4e00\u4e2a\u9009\u9879\u201cAdd Python to environment variables\u201d\uff0c\u786e\u4fdd\u52fe\u9009\u5b83\u3002<\/p>\n<\/p>\n<p><p>\u5982\u679c\u5b89\u88c5\u5b8c\u6210\u540e\u53d1\u73b0\u6ca1\u6709\u52fe\u9009\u8be5\u9009\u9879\uff0c\u4f60\u53ef\u4ee5\u624b\u52a8\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\u3002\u6253\u5f00\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\uff0c\u9009\u62e9\u201c\u9ad8\u7ea7\u201d\u9009\u9879\u5361\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u4e2d\uff0c\u627e\u5230\u201cPath\u201d\u53d8\u91cf\uff0c\u70b9\u51fb\u201c\u7f16\u8f91\u201d\uff0c\u7136\u540e\u6dfb\u52a0Python\u7684\u5b89\u88c5\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u9a8c\u8bc1\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08Command Prompt\uff09\uff0c\u8f93\u5165<code>python --version<\/code>\uff0c\u67e5\u770bPython\u7248\u672c\u4fe1\u606f\uff0c\u4ee5\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002\u5982\u679c\u547d\u4ee4\u8fd4\u56de\u6b63\u786e\u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660ePython\u5df2\u7ecf\u5b89\u88c5\u5e76\u914d\u7f6e\u6b63\u786e\u3002<\/p>\n<\/p>\n<p><p>\u4f60\u8fd8\u53ef\u4ee5\u5c1d\u8bd5\u8fd0\u884cPython\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\uff0c\u8f93\u5165<code>python<\/code>\u547d\u4ee4\uff0c\u7136\u540e\u5728\u63d0\u793a\u7b26\u4e0b\u8f93\u5165\u7b80\u5355\u7684Python\u547d\u4ee4\uff0c\u5982<code>print(&quot;Hello, World!&quot;)<\/code>\uff0c\u4ee5\u786e\u4fddPython\u73af\u5883\u8fd0\u884c\u6b63\u5e38\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u5b89\u88c5\u5176\u4ed6Python\u5e93<\/h3>\n<\/p>\n<p><p>\u73b0\u5728\u4f60\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u4e86Python\uff0c\u5e76\u5c06\u5176\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u63a5\u4e0b\u6765\u53ef\u4ee5\u4f7f\u7528pip\u5de5\u5177\u5b89\u88c5\u5176\u4ed6Python\u5e93\u3002\u6bd4\u5982\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5NumPy\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip install numpy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>pip\u5c06\u81ea\u52a8\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6307\u5b9a\u7684\u5e93\uff0c\u5e76\u5904\u7406\u6240\u6709\u4f9d\u8d56\u5173\u7cfb\u3002\u786e\u4fdd\u4f60\u7684\u7f51\u7edc\u8fde\u63a5\u6b63\u5e38\uff0c\u4ee5\u4fbfpip\u53ef\u4ee5\u8bbf\u95eePython\u5305\u7d22\u5f15\uff08PyPI\uff09\u4e0b\u8f7d\u5e93\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u6bd4\u5982\u6743\u9650\u4e0d\u8db3\u3001\u8def\u5f84\u4e0d\u6b63\u786e\u7b49\u3002\u786e\u4fdd\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9009\u62e9\u4e86\u6b63\u786e\u7684\u9009\u9879\uff0c\u5e76\u5728\u5b89\u88c5\u8def\u5f84\u4e0a\u6709\u8db3\u591f\u7684\u6743\u9650\u3002\u5982\u679c\u9047\u5230\u8def\u5f84\u95ee\u9898\uff0c\u68c0\u67e5\u5b89\u88c5\u8def\u5f84\u662f\u5426\u5b58\u5728\uff0c\u6216\u8005\u5c1d\u8bd5\u4f7f\u7528\u7ba1\u7406\u5458\u6743\u9650\u91cd\u65b0\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><p>\u5982\u679c\u5728\u4f7f\u7528pip\u5b89\u88c5\u5e93\u65f6\u9047\u5230\u95ee\u9898\uff0c\u5c1d\u8bd5\u66f4\u65b0pip\u5230\u6700\u65b0\u7248\u672c\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\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<p><p>\u66f4\u65b0\u540e\u518d\u6b21\u5c1d\u8bd5\u5b89\u88c5\u6240\u9700\u7684\u5e93\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u5728\u5176\u4ed6\u76d8\u6210\u529f\u5b89\u88c5Python\uff0c\u5e76\u914d\u7f6e\u597d\u73af\u5883\u4ee5\u4fbf\u540e\u7eed\u4f7f\u7528\u3002\u786e\u4fdd\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9009\u62e9\u6b63\u786e\u7684\u9009\u9879\uff0c\u5e76\u4ed4\u7ec6\u68c0\u67e5\u6bcf\u4e00\u6b65\uff0c\u4ee5\u907f\u514d\u5e38\u89c1\u7684\u5b89\u88c5\u95ee\u9898\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728\u4e0d\u540c\u7684\u76d8\u7b26\u4e0a\u5b89\u88c5Python\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u4f4d\u7f6e\u6765\u5b9e\u73b0\u3002\u5728Python\u5b89\u88c5\u5411\u5bfc\u4e2d\uff0c\u9009\u62e9\u201cCustomize installation\u201d\uff0c\u7136\u540e\u5728\u201cAdvanced Options\u201d\u4e2d\u66f4\u6539\u5b89\u88c5\u8def\u5f84\uff0c\u9009\u62e9\u4f60\u5e0c\u671b\u5b89\u88c5\u7684\u76d8\u7b26\uff0c\u6bd4\u5982D\u76d8\u6216E\u76d8\u3002\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u786e\u4fddPython\u548c\u76f8\u5e94\u7684\u5e93\u5b89\u88c5\u5728\u4f60\u6307\u5b9a\u7684\u76ee\u5f55\u3002<\/p>\n<p><strong>\u5b89\u88c5Python\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u7cfb\u7edf\u6743\u9650\u95ee\u9898\uff1f<\/strong><br \/>\u5728\u975eC\u76d8\u4e0a\u5b89\u88c5Python\u65f6\uff0c\u786e\u4fdd\u4f60\u6709\u8db3\u591f\u7684\u6743\u9650\u53bb\u5199\u5165\u90a3\u4e2a\u76d8\u7b26\u3002\u67d0\u4e9b\u64cd\u4f5c\u7cfb\u7edf\u53ef\u80fd\u4f1a\u5bf9\u4e0d\u540c\u7684\u76d8\u7b26\u8bbe\u7f6e\u6743\u9650\u9650\u5236\uff0c\u5c24\u5176\u662f\u5728\u4f01\u4e1a\u73af\u5883\u4e2d\u3002\u5982\u679c\u9047\u5230\u6743\u9650\u95ee\u9898\uff0c\u53ef\u4ee5\u8003\u8651\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff0c\u6216\u8005\u9009\u62e9\u4e00\u4e2a\u7528\u6237\u6743\u9650\u8f83\u9ad8\u7684\u76ee\u5f55\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p><strong>\u53ef\u4ee5\u5728\u4e00\u4e2a\u76d8\u7b26\u4e0a\u5b89\u88c5\u591a\u4e2aPython\u7248\u672c\u5417\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u76d8\u7b26\u4e0a\u5b89\u88c5\u591a\u4e2aPython\u7248\u672c\u3002\u4e3a\u4e86\u907f\u514d\u51b2\u7a81\uff0c\u5efa\u8bae\u4e3a\u6bcf\u4e2a\u7248\u672c\u521b\u5efa\u72ec\u7acb\u7684\u6587\u4ef6\u5939\uff0c\u5e76\u5728\u5b89\u88c5\u65f6\u9009\u62e9\u4e0d\u540c\u7684\u8def\u5f84\u3002\u6b64\u5916\uff0c\u4f7f\u7528\u865a\u62df\u73af\u5883\uff08\u5982venv\u6216conda\uff09\u4e5f\u662f\u4e00\u4e2a\u597d\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5728\u540c\u4e00\u7248\u672c\u7684Python\u4e2d\u7ba1\u7406\u591a\u4e2a\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u786e\u4fdd\u5b83\u4eec\u4e0d\u4f1a\u76f8\u4e92\u5e72\u6270\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728\u5176\u4ed6\u76d8\u5b89\u88c5Python\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a\u4e0b\u8f7dPython\u5b89\u88c5\u7a0b\u5e8f\u3001\u9009\u62e9\u81ea\u5b9a\u4e49\u5b89\u88c5\u3001\u9009\u62e9\u76ee\u6807\u5b89\u88c5\u8def\u5f84\u3002 [&hellip;]","protected":false},"author":3,"featured_media":983562,"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\/983545"}],"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=983545"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/983545\/revisions"}],"predecessor-version":[{"id":983566,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/983545\/revisions\/983566"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/983562"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=983545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=983545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=983545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}