{"id":923178,"date":"2024-12-26T14:45:13","date_gmt":"2024-12-26T06:45:13","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/923178.html"},"modified":"2024-12-26T14:45:15","modified_gmt":"2024-12-26T06:45:15","slug":"%e5%a6%82%e4%bd%95%e6%89%bepython%e6%ba%90%e7%a0%81","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/923178.html","title":{"rendered":"\u5982\u4f55\u627epython\u6e90\u7801"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24211347\/e70961a0-4c48-4f69-840d-416464623718.webp\" alt=\"\u5982\u4f55\u627epython\u6e90\u7801\" \/><\/p>\n<p><p> <strong>\u8981\u627ePython\u6e90\u7801\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u5f0f\uff1a\u67e5\u9605Python\u5b98\u65b9\u7f51\u7ad9\u3001\u4f7f\u7528GitHub\u5e73\u53f0\u3001\u67e5\u770bPython\u5305\u7ba1\u7406\u5de5\u5177\u3001\u5229\u7528Python\u7684\u5185\u7f6e\u6a21\u5757\u3001\u8bbf\u95ee\u5728\u7ebf\u7f16\u7a0b\u793e\u533a\u3002<\/strong>\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u901a\u8fc7\u8fd9\u4e9b\u9014\u5f84\u627e\u5230Python\u6e90\u7801\uff0c\u5e76\u63d0\u4f9b\u4e00\u4e9b\u76f8\u5173\u7684\u8d44\u6e90\u548c\u5efa\u8bae\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u67e5\u9605Python\u5b98\u65b9\u7f51\u7ad9<\/p>\n<\/p>\n<p><p>Python\u5b98\u65b9\u7f51\u7ad9\u662f\u83b7\u53d6Python\u6e90\u7801\u7684\u6700\u76f4\u63a5\u9014\u5f84\u3002Python\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0d\u4ec5\u63d0\u4f9b\u4e86\u6700\u65b0\u7248\u672c\u7684Python\u89e3\u91ca\u5668\u4e0b\u8f7d\uff0c\u8fd8\u63d0\u4f9b\u4e86\u6240\u6709\u516c\u5f00\u53d1\u5e03\u7684Python\u7248\u672c\u7684\u6e90\u7801\u3002\u8981\u67e5\u627ePython\u6e90\u7801\uff0c\u4f60\u53ef\u4ee5\u8bbf\u95eePython\u7684\u4e0b\u8f7d\u9875\u9762\uff0c\u9009\u62e9\u6240\u9700\u7684Python\u7248\u672c\uff0c\u7136\u540e\u4e0b\u8f7d\u5bf9\u5e94\u7684\u6e90\u7801\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><p>Python\u5b98\u65b9\u7f51\u7ad9\u4e0a\u8fd8\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6587\u6863\u8d44\u6e90\uff0c\u5305\u62ecPython\u7684\u5b98\u65b9\u6587\u6863\u3001\u6807\u51c6\u5e93\u53c2\u8003\u3001\u6559\u7a0b\u548c\u6307\u5357\u7b49\u3002\u8fd9\u4e9b\u6587\u6863\u53ef\u4ee5\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3Python\u6e90\u7801\u7684\u7ed3\u6784\u548c\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528GitHub\u5e73\u53f0<\/p>\n<\/p>\n<p><p>GitHub\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff0c\u8bb8\u591a\u5f00\u6e90\u9879\u76ee\uff0c\u5305\u62ecPython\u672c\u8eab\uff0c\u90fd\u6258\u7ba1\u5728GitHub\u4e0a\u3002\u8981\u67e5\u627ePython\u7684\u6e90\u7801\uff0c\u4f60\u53ef\u4ee5\u8bbf\u95eePython\u7684GitHub\u4ed3\u5e93\u3002\u5728\u8fd9\u4e2a\u4ed3\u5e93\u4e2d\uff0c\u4f60\u53ef\u4ee5\u627e\u5230Python\u7684\u4e0d\u540c\u7248\u672c\u5206\u652f\uff0c\u67e5\u770b\u548c\u4e0b\u8f7d\u6e90\u7801\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><p>GitHub\u4e0d\u4ec5\u4ec5\u662f\u4e00\u4e2a\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff0c\u5b83\u8fd8\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u534f\u4f5c\u5de5\u5177\uff0c\u5982\u95ee\u9898\u8ddf\u8e2a\u3001<a href=\"https:\/\/docs.pingcode.com\/code-review\" target=\"_blank\">\u4ee3\u7801\u5ba1\u67e5<\/a>\u3001\u8ba8\u8bba\u533a\u7b49\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u53c2\u4e0e\u5f00\u6e90\u9879\u76ee\u7684\u5f00\u53d1\u548c\u7ef4\u62a4\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u67e5\u770bPython\u5305\u7ba1\u7406\u5de5\u5177<\/p>\n<\/p>\n<p><p>Python\u6709\u591a\u4e2a\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u5982pip\u3001conda\u7b49\uff0c\u5b83\u4eec\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305\u3002\u901a\u8fc7\u8fd9\u4e9b\u5de5\u5177\uff0c\u4f60\u53ef\u4ee5\u65b9\u4fbf\u5730\u67e5\u627e\u548c\u4e0b\u8f7dPython\u5305\u7684\u6e90\u7801\u3002<\/p>\n<\/p>\n<p><p>\u8bb8\u591aPython\u5305\u5728\u53d1\u5e03\u65f6\u90fd\u4f1a\u63d0\u4f9b\u6e90\u7801\u5305\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7pip\u547d\u4ee4\u884c\u5de5\u5177\u6765\u4e0b\u8f7d\u6e90\u7801\u5305\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>pip download<\/code>\u547d\u4ee4\u53ef\u4ee5\u4e0b\u8f7d\u6307\u5b9a\u5305\u7684\u6e90\u7801\u5305\uff0c\u4f9b\u4f60\u67e5\u770b\u548c\u7814\u7a76\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u5229\u7528Python\u7684\u5185\u7f6e\u6a21\u5757<\/p>\n<\/p>\n<p><p>Python\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5185\u7f6e\u6a21\u5757\uff0c\u5982<code>inspect<\/code>\u3001<code>sys<\/code>\u7b49\uff0c\u5b83\u4eec\u53ef\u4ee5\u5e2e\u52a9\u4f60\u52a8\u6001\u5730\u67e5\u770bPython\u6e90\u7801\u3002\u5728Python\u89e3\u91ca\u5668\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e9b\u6a21\u5757\u6765\u67e5\u770b\u51fd\u6570\u3001\u7c7b\u3001\u6a21\u5757\u7b49\u7684\u6e90\u7801\u3002<\/p>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u4f7f\u7528<code>inspect<\/code>\u6a21\u5757\u7684<code>getsource<\/code>\u51fd\u6570\u53ef\u4ee5\u83b7\u53d6\u6307\u5b9a\u5bf9\u8c61\u7684\u6e90\u7801\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u67e5\u770b\u5df2\u7ecf\u52a0\u8f7d\u5230\u5185\u5b58\u4e2d\u7684Python\u4ee3\u7801\uff0c\u5bf9\u4e8e\u52a8\u6001\u5206\u6790\u548c\u8c03\u8bd5\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u8bbf\u95ee\u5728\u7ebf\u7f16\u7a0b\u793e\u533a<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u5b98\u65b9\u8d44\u6e90\u548c\u5de5\u5177\u5916\uff0c\u5728\u7ebf\u7f16\u7a0b\u793e\u533a\u4e5f\u662f\u83b7\u53d6Python\u6e90\u7801\u7684\u91cd\u8981\u9014\u5f84\u3002\u5728\u8fd9\u4e9b\u793e\u533a\u4e2d\uff0c\u4f60\u53ef\u4ee5\u627e\u5230\u8bb8\u591a\u5173\u4e8ePython\u6e90\u7801\u7684\u8ba8\u8bba\u3001\u5206\u4eab\u548c\u6559\u7a0b\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u4e9b\u77e5\u540d\u7684\u7f16\u7a0b\u793e\u533a\u5305\u62ecStack Overflow\u3001Reddit\u7684Python\u7248\u5757\u3001Python\u8bba\u575b\u7b49\u3002\u8fd9\u4e9b\u793e\u533a\u4e0d\u4ec5\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u8d44\u6e90\uff0c\u8fd8\u6c47\u805a\u4e86\u4f17\u591aPython\u5f00\u53d1\u8005\uff0c\u4f60\u53ef\u4ee5\u5728\u8fd9\u91cc\u63d0\u51fa\u95ee\u9898\u3001\u5206\u4eab\u7ecf\u9a8c\u3001\u83b7\u53d6\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<p><p>\u516d\u3001\u4f7f\u7528\u5f00\u6e90\u4ee3\u7801\u641c\u7d22\u5f15\u64ce<\/p>\n<\/p>\n<p><p>\u5f00\u6e90\u4ee3\u7801\u641c\u7d22\u5f15\u64ce\u662f\u67e5\u627ePython\u6e90\u7801\u7684\u53e6\u4e00\u4e2a\u6709\u529b\u5de5\u5177\u3002\u8fd9\u4e9b\u641c\u7d22\u5f15\u64ce\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5feb\u901f\u5b9a\u4f4d\u7279\u5b9a\u7684\u4ee3\u7801\u7247\u6bb5\u3001\u51fd\u6570\u6216\u7c7b\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u4e9b\u77e5\u540d\u7684\u5f00\u6e90\u4ee3\u7801\u641c\u7d22\u5f15\u64ce\u5305\u62ecSourcegraph\u3001Krugle\u3001Searchcode\u7b49\u3002\u901a\u8fc7\u8fd9\u4e9b\u641c\u7d22\u5f15\u64ce\uff0c\u4f60\u53ef\u4ee5\u5728\u5927\u91cf\u7684\u5f00\u6e90\u4ee3\u7801\u5e93\u4e2d\u8fdb\u884c\u641c\u7d22\uff0c\u627e\u5230\u4f60\u9700\u8981\u7684Python\u6e90\u7801\u3002<\/p>\n<\/p>\n<p><p>\u4e03\u3001\u5206\u6790Python\u6e90\u7801\u7684\u6280\u5de7<\/p>\n<\/p>\n<p><p>\u627e\u5230Python\u6e90\u7801\u540e\uff0c\u5206\u6790\u548c\u7406\u89e3\u6e90\u7801\u662f\u53e6\u4e00\u4e2a\u91cd\u8981\u7684\u6b65\u9aa4\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5206\u6790Python\u6e90\u7801\u7684\u6280\u5de7\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p>\u9605\u8bfb\u6587\u6863\u548c\u6ce8\u91ca\uff1a\u5927\u591a\u6570\u5f00\u6e90\u9879\u76ee\u90fd\u4f1a\u63d0\u4f9b\u8be6\u7ec6\u7684\u6587\u6863\u548c\u6ce8\u91ca\uff0c\u8fd9\u4e9b\u8d44\u6e90\u53ef\u4ee5\u5e2e\u52a9\u4f60\u7406\u89e3\u6e90\u7801\u7684\u8bbe\u8ba1\u548c\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u7406\u89e3\u6e90\u7801\u7ed3\u6784\uff1a\u6e90\u7801\u901a\u5e38\u7531\u591a\u4e2a\u6a21\u5757\u548c\u5305\u7ec4\u6210\uff0c\u7406\u89e3\u5176\u7ed3\u6784\u6709\u52a9\u4e8e\u4f60\u66f4\u597d\u5730\u5206\u6790\u6e90\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528\u8c03\u8bd5\u5de5\u5177\uff1aPython\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5f3a\u5927\u7684\u8c03\u8bd5\u5de5\u5177\uff0c\u5982pdb\u3001ipdb\u7b49\uff0c\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u4f60\u52a8\u6001\u5730\u5206\u6790\u548c\u8c03\u8bd5\u6e90\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u53c2\u4e0e\u793e\u533a\u8ba8\u8bba\uff1a\u5728\u793e\u533a\u4e2d\u53c2\u4e0e\u8ba8\u8bba\uff0c\u53ef\u4ee5\u83b7\u53d6\u5176\u4ed6\u5f00\u53d1\u8005\u7684\u89c2\u70b9\u548c\u7ecf\u9a8c\uff0c\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u6e90\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516b\u3001\u603b\u7ed3\u548c\u5efa\u8bae<\/p>\n<\/p>\n<p><p>\u67e5\u627e\u548c\u5206\u6790Python\u6e90\u7801\u662f\u63d0\u9ad8\u7f16\u7a0b\u6280\u80fd\u548c\u6df1\u5165\u7406\u89e3Python\u7684\u91cd\u8981\u9014\u5f84\u3002\u5728\u5bfb\u627e\u6e90\u7801\u65f6\uff0c\u4f60\u53ef\u4ee5\u5229\u7528Python\u5b98\u65b9\u7f51\u7ad9\u3001GitHub\u3001\u5305\u7ba1\u7406\u5de5\u5177\u3001\u5185\u7f6e\u6a21\u5757\u3001\u5728\u7ebf\u793e\u533a\u7b49\u8d44\u6e90\u3002\u540c\u65f6\uff0c\u5728\u5206\u6790\u6e90\u7801\u65f6\uff0c\u8981\u6ce8\u610f\u9605\u8bfb\u6587\u6863\u3001\u7406\u89e3\u7ed3\u6784\u3001\u4f7f\u7528\u8c03\u8bd5\u5de5\u5177\uff0c\u5e76\u79ef\u6781\u53c2\u4e0e\u793e\u533a\u8ba8\u8bba\u3002\u901a\u8fc7\u8fd9\u4e9b\u65b9\u5f0f\uff0c\u4f60\u53ef\u4ee5\u66f4\u597d\u5730\u638c\u63e1Python\u7684\u6e90\u7801\uff0c\u63d0\u9ad8\u81ea\u5df1\u7684\u7f16\u7a0b\u80fd\u529b\u548c\u9879\u76ee\u5f00\u53d1\u6c34\u5e73\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5bfb\u627e\u7279\u5b9a\u7684Python\u5e93\u6216\u6846\u67b6\u7684\u6e90\u7801\uff1f<\/strong><br \/>\u8981\u627e\u5230\u7279\u5b9a\u7684Python\u5e93\u6216\u6846\u67b6\u7684\u6e90\u7801\uff0c\u60a8\u53ef\u4ee5\u8bbf\u95ee\u5176\u5728GitHub\u6216\u5176\u4ed6\u7248\u672c\u63a7\u5236\u5e73\u53f0\u4e0a\u7684\u5b98\u65b9\u9875\u9762\u3002\u5927\u591a\u6570\u5f00\u6e90Python\u9879\u76ee\u90fd\u4f1a\u5728GitHub\u4e0a\u6258\u7ba1\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u641c\u7d22\u9879\u76ee\u540d\u79f0\u627e\u5230\u76f8\u5173\u7684\u4ee3\u7801\u5e93\u3002\u6b64\u5916\uff0cPython Package Index (PyPI) \u4e5f\u63d0\u4f9b\u4e86\u8bb8\u591a\u5e93\u7684\u94fe\u63a5\uff0c\u901a\u5e38\u53ef\u4ee5\u5728\u9879\u76ee\u9875\u9762\u4e2d\u627e\u5230\u6e90\u7801\u7684\u4e0b\u8f7d\u94fe\u63a5\u3002<\/p>\n<p><strong>\u5728\u672c\u5730\u673a\u5668\u4e0a\u5982\u4f55\u67e5\u770b\u5df2\u5b89\u88c5Python\u5e93\u7684\u6e90\u7801\uff1f<\/strong><br \/>\u5982\u679c\u60a8\u5e0c\u671b\u67e5\u770b\u5df2\u5b89\u88c5\u7684Python\u5e93\u7684\u6e90\u7801\uff0c\u53ef\u4ee5\u901a\u8fc7Python\u7684\u5305\u7ba1\u7406\u5de5\u5177\u5982pip\u627e\u5230\u5176\u5b89\u88c5\u4f4d\u7f6e\u3002\u4f7f\u7528\u547d\u4ee4<code>pip show &lt;package_name&gt;<\/code>\u53ef\u4ee5\u83b7\u53d6\u5305\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u5b89\u88c5\u8def\u5f84\u3002\u7136\u540e\uff0c\u60a8\u53ef\u4ee5\u76f4\u63a5\u5bfc\u822a\u5230\u8be5\u8def\u5f84\uff0c\u67e5\u770b\u5e93\u7684\u6e90\u7801\u6587\u4ef6\u3002<\/p>\n<p><strong>\u662f\u5426\u6709\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u6211\u641c\u7d22\u548c\u6d4f\u89c8Python\u6e90\u7801\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u6709\u4e00\u4e9b\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u60a8\u641c\u7d22\u548c\u6d4f\u89c8Python\u6e90\u7801\u3002\u6bd4\u5982\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<code>grep<\/code>\u547d\u4ee4\u5728\u7ec8\u7aef\u4e2d\u641c\u7d22\u7279\u5b9a\u7684\u51fd\u6570\u6216\u7c7b\u5b9a\u4e49\u3002\u6b64\u5916\uff0cIDE\u5982PyCharm\u6216VS Code\u4e5f\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u4ee3\u7801\u641c\u7d22\u529f\u80fd\uff0c\u5141\u8bb8\u60a8\u5728\u6574\u4e2a\u9879\u76ee\u4e2d\u5feb\u901f\u627e\u5230\u6240\u9700\u7684\u6e90\u7801\u90e8\u5206\u3002\u8fd8\u6709\u4e00\u4e9b\u5728\u7ebf\u8d44\u6e90\uff0c\u5982Read the Docs\uff0c\u63d0\u4f9b\u4e86\u8bb8\u591aPython\u5e93\u7684\u6587\u6863\u548c\u6e90\u7801\u6d4f\u89c8\u529f\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u627ePython\u6e90\u7801\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u5f0f\uff1a\u67e5\u9605Python\u5b98\u65b9\u7f51\u7ad9\u3001\u4f7f\u7528GitHub\u5e73\u53f0\u3001\u67e5\u770bPython\u5305 [&hellip;]","protected":false},"author":3,"featured_media":923184,"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\/923178"}],"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=923178"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/923178\/revisions"}],"predecessor-version":[{"id":923185,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/923178\/revisions\/923185"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/923184"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=923178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=923178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=923178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}