{"id":942135,"date":"2024-12-26T21:53:09","date_gmt":"2024-12-26T13:53:09","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/942135.html"},"modified":"2024-12-26T21:53:11","modified_gmt":"2024-12-26T13:53:11","slug":"python%e5%a6%82%e4%bd%95%e6%90%9c%e7%b4%a2%e5%8c%85","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/942135.html","title":{"rendered":"python\u5982\u4f55\u641c\u7d22\u5305"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25080050\/73a660f2-0253-4894-a179-bd77c8b589f7.webp\" alt=\"python\u5982\u4f55\u641c\u7d22\u5305\" \/><\/p>\n<p><p> \u4e00\u3001Python\u5982\u4f55\u641c\u7d22\u5305  <\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u641c\u7d22\u5305\u7684\u65b9\u5f0f\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a<strong>\u4f7f\u7528pip\u547d\u4ee4\u3001\u901a\u8fc7Anaconda\u641c\u7d22\u3001\u5229\u7528Python Package Index (PyPI) \u7f51\u7ad9\u3001\u901a\u8fc7IDE\u5185\u7f6e\u5de5\u5177<\/strong>\u3002\u5176\u4e2d\uff0c\u4f7f\u7528pip\u547d\u4ee4\u662f\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\uff0c\u5b83\u662fPython\u5b98\u65b9\u63a8\u8350\u7684\u5305\u7ba1\u7406\u5de5\u5177\u3002\u901a\u8fc7<code>pip search package_name<\/code>\u547d\u4ee4\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u641c\u7d22\u4e0e\u6307\u5b9a\u5173\u952e\u5b57\u5339\u914d\u7684\u5305\u3002\u4f7f\u7528pip\u547d\u4ee4\u7684\u4f18\u70b9\u662f\u5b83\u7b80\u5355\u5feb\u6377\uff0c\u5e76\u4e14\u53ef\u4ee5\u76f4\u63a5\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\uff0c\u65e0\u9700\u8bbf\u95ee\u7f51\u7ad9\u6216\u6253\u5f00\u989d\u5916\u7684\u8f6f\u4ef6\u3002\u6b64\u5916\uff0cpip\u8fd8\u652f\u6301\u8be6\u7ec6\u7684\u5305\u4fe1\u606f\u663e\u793a\u548c\u5b89\u88c5\uff0c\u6781\u5927\u5730\u65b9\u4fbf\u4e86\u5f00\u53d1\u8005\u7684\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001PIP\u547d\u4ee4\u641c\u7d22\u5305<\/p>\n<\/p>\n<p><p>PIP\u662fPython\u6700\u5e38\u7528\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u80fd\u591f\u65b9\u4fbf\u5730\u641c\u7d22\u548c\u5b89\u88c5Python\u5305\u3002\u4f7f\u7528PIP\u547d\u4ee4\u884c\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u641c\u7d22\u5305\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u57fa\u672c\u4f7f\u7528\u65b9\u6cd5<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>pip search<\/code>\u547d\u4ee4\u53ef\u4ee5\u5728PyPI\u4e0a\u641c\u7d22\u5305\u3002\u683c\u5f0f\u4e3a\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">pip search &lt;package_name&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5176\u4e2d<code>&lt;package_name&gt;<\/code>\u662f\u4f60\u60f3\u641c\u7d22\u7684\u5305\u7684\u540d\u79f0\u6216\u5173\u952e\u5b57\u3002PIP\u4f1a\u8fd4\u56de\u4e0e\u5173\u952e\u5b57\u5339\u914d\u7684\u5305\u5217\u8868\u53ca\u5176\u7b80\u8981\u63cf\u8ff0\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>PIP\u547d\u4ee4\u7684\u4f18\u52bf<\/strong><\/p>\n<\/p>\n<p><p>PIP\u547d\u4ee4\u7684\u4f18\u52bf\u5728\u4e8e\u5b83\u7684\u7b80\u5355\u548c\u5feb\u6377\uff0c\u65e0\u9700\u6253\u5f00\u6d4f\u89c8\u5668\u6216\u5176\u4ed6\u8f6f\u4ef6\uff0c\u76f4\u63a5\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u5373\u53ef\u3002\u540c\u65f6\uff0cPIP\u8fd8\u53ef\u4ee5\u663e\u793a\u5305\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u7248\u672c\u53f7\u548c\u7b80\u8981\u63cf\u8ff0\uff0c\u5e2e\u52a9\u7528\u6237\u5feb\u901f\u4e86\u89e3\u5305\u7684\u529f\u80fd\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u901a\u8fc7Anaconda\u641c\u7d22\u5305<\/p>\n<\/p>\n<p><p>Anaconda\u662f\u4e00\u79cd\u6d41\u884c\u7684\u6570\u636e\u79d1\u5b66\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u5f00\u53d1\u73af\u5883\uff0c\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u5305\u7ba1\u7406\u529f\u80fd\u3002\u901a\u8fc7Anaconda\uff0c\u7528\u6237\u53ef\u4ee5\u65b9\u4fbf\u5730\u641c\u7d22\u548c\u7ba1\u7406Python\u5305\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528conda\u547d\u4ee4\u641c\u7d22<\/strong><\/p>\n<\/p>\n<p><p>\u5728Anaconda\u73af\u5883\u4e2d\uff0c\u4f7f\u7528<code>conda search<\/code>\u547d\u4ee4\u53ef\u4ee5\u641c\u7d22\u5305\u3002\u683c\u5f0f\u4e3a\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">conda search &lt;package_name&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8be5\u547d\u4ee4\u4f1a\u5217\u51fa\u4e0e\u5173\u952e\u5b57\u5339\u914d\u7684\u5305\u53ca\u5176\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u7248\u672c\u3001\u6e20\u9053\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Anaconda\u7684\u4f18\u70b9<\/strong><\/p>\n<\/p>\n<p><p>Anaconda\u7684\u4f18\u70b9\u5728\u4e8e\u5b83\u96c6\u6210\u4e86\u5927\u91cf\u7684\u6570\u636e\u79d1\u5b66\u548c\u673a\u5668\u5b66\u4e60\u5de5\u5177\uff0c\u5e76\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5305\u7ba1\u7406\u9009\u9879\u3002\u901a\u8fc7Anaconda\uff0c\u7528\u6237\u4e0d\u4ec5\u53ef\u4ee5\u641c\u7d22\u548c\u5b89\u88c5\u5305\uff0c\u8fd8\u53ef\u4ee5\u521b\u5efa\u548c\u7ba1\u7406\u865a\u62df\u73af\u5883\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u5229\u7528Python Package Index (PyPI) \u7f51\u7ad9<\/p>\n<\/p>\n<p><p>Python Package Index (PyPI) \u662f\u4e00\u4e2a\u5b98\u65b9\u7684Python\u5305\u4ed3\u5e93\uff0c\u63d0\u4f9b\u4e86\u6d77\u91cf\u7684Python\u5305\u4f9b\u7528\u6237\u4e0b\u8f7d\u548c\u4f7f\u7528\u3002\u901a\u8fc7\u8bbf\u95eePyPI\u7f51\u7ad9\uff0c\u7528\u6237\u53ef\u4ee5\u8f7b\u677e\u5730\u641c\u7d22\u548c\u6d4f\u89c8\u5305\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u641c\u7d22\u4e0e\u6d4f\u89c8<\/strong><\/p>\n<\/p>\n<p><p>\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95eePyPI\u7f51\u7ad9\uff08<a href=\"https:\/\/pypi.org\/%EF%BC%89%EF%BC%8C%E5%9C%A8%E6%90%9C%E7%B4%A2%E6%A1%86%E4%B8%AD%E8%BE%93%E5%85%A5%E5%85%B3%E9%94%AE%E5%AD%97%EF%BC%8C%E5%8D%B3%E5%8F%AF%E6%90%9C%E7%B4%A2%E4%B8%8E%E4%B9%8B%E5%8C%B9%E9%85%8D%E7%9A%84%E5%8C%85%E3%80%82PyPI%E4%BC%9A%E8%BF%94%E5%9B%9E%E5%8C%85%E5%88%97%E8%A1%A8%EF%BC%8C%E5%B9%B6%E6%8F%90%E4%BE%9B%E8%AF%A6%E7%BB%86%E7%9A%84%E5%8C%85%E4%BF%A1%E6%81%AF%EF%BC%8C%E5%8C%85%E6%8B%AC%E7%89%88%E6%9C%AC%E3%80%81%E4%BE%9D%E8%B5%96%E5%85%B3%E7%B3%BB%E3%80%81%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E%E7%AD%89%E3%80%82\">https:\/\/pypi.org\/\uff09\uff0c\u5728\u641c\u7d22\u6846\u4e2d\u8f93\u5165\u5173\u952e\u5b57\uff0c\u5373\u53ef\u641c\u7d22\u4e0e\u4e4b\u5339\u914d\u7684\u5305\u3002PyPI\u4f1a\u8fd4\u56de\u5305\u5217\u8868\uff0c\u5e76\u63d0\u4f9b\u8be6\u7ec6\u7684\u5305\u4fe1\u606f\uff0c\u5305\u62ec\u7248\u672c\u3001\u4f9d\u8d56\u5173\u7cfb\u3001\u4f7f\u7528\u8bf4\u660e\u7b49\u3002<\/a><\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>PyPI\u7f51\u7ad9\u7684\u4f18\u52bf<\/strong><\/p>\n<\/p>\n<p><p>PyPI\u7f51\u7ad9\u7684\u4f18\u52bf\u5728\u4e8e\u5176\u5168\u9762\u548c\u8be6\u7ec6\u7684\u4fe1\u606f\u5c55\u793a\u3002\u7528\u6237\u53ef\u4ee5\u901a\u8fc7PyPI\u83b7\u53d6\u5305\u7684\u5b8c\u6574\u6587\u6863\u3001\u5b89\u88c5\u8bf4\u660e\u548c\u4f7f\u7528\u793a\u4f8b\uff0c\u5e2e\u52a9\u4ed6\u4eec\u66f4\u597d\u5730\u7406\u89e3\u548c\u4f7f\u7528\u5305\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u901a\u8fc7IDE\u5185\u7f6e\u5de5\u5177<\/p>\n<\/p>\n<p><p>\u8bb8\u591a\u73b0\u4ee3\u5316\u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u90fd\u63d0\u4f9b\u4e86\u5185\u7f6e\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u4f7f\u7528\u6237\u80fd\u591f\u5728\u5f00\u53d1\u73af\u5883\u4e2d\u76f4\u63a5\u641c\u7d22\u548c\u5b89\u88c5Python\u5305\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>PyCharm<\/strong><\/p>\n<\/p>\n<p><p>PyCharm\u662f\u4e00\u4e2a\u6d41\u884c\u7684Python IDE\uff0c\u63d0\u4f9b\u4e86\u5185\u7f6e\u7684\u5305\u7ba1\u7406\u5de5\u5177\u3002\u5728PyCharm\u4e2d\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u201cSettings\u201d -&gt; \u201cProject: <project_name>\u201d -&gt; \u201cPython Interpreter\u201d\u6765\u641c\u7d22\u548c\u5b89\u88c5\u5305\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Visual Studio Code<\/strong><\/p>\n<\/p>\n<p><p>Visual Studio Code (VSCode) \u662f\u53e6\u4e00\u4e2a\u6d41\u884c\u7684IDE\uff0c\u652f\u6301Python\u5f00\u53d1\u3002\u901a\u8fc7\u5b89\u88c5Python\u6269\u5c55\uff0c\u7528\u6237\u53ef\u4ee5\u5728VSCode\u4e2d\u4f7f\u7528\u5185\u7f6e\u7684\u547d\u4ee4\u884c\u5de5\u5177\u6765\u641c\u7d22\u548c\u5b89\u88c5\u5305\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>IDE\u5de5\u5177\u7684\u4f18\u52bf<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528IDE\u5185\u7f6e\u7684\u5de5\u5177\u641c\u7d22\u5305\u7684\u4f18\u52bf\u5728\u4e8e\u5b83\u4eec\u901a\u5e38\u4e0e\u5f00\u53d1\u73af\u5883\u7d27\u5bc6\u96c6\u6210\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u7f16\u5199\u4ee3\u7801\u7684\u540c\u65f6\u7ba1\u7406\u5305\uff0c\u65e0\u9700\u79bb\u5f00\u5f00\u53d1\u73af\u5883\u3002\u6b64\u5916\uff0cIDE\u8fd8\u63d0\u4f9b\u4e86\u667a\u80fd\u63d0\u793a\u548c\u81ea\u52a8\u8865\u5168\u529f\u80fd\uff0c\u63d0\u9ad8\u4e86\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u641c\u7d22\u5305\u7684\u65b9\u6cd5\u591a\u79cd\u591a\u6837\uff0c\u5305\u62ec\u4f7f\u7528PIP\u547d\u4ee4\u3001Anaconda\u3001PyPI\u7f51\u7ad9\u548cIDE\u5185\u7f6e\u5de5\u5177\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u72ec\u7279\u7684\u4f18\u52bf\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u548c\u4e60\u60ef\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177\u3002\u65e0\u8bba\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\uff0c\u4e86\u89e3\u5e76\u719f\u7ec3\u638c\u63e1\u8fd9\u4e9b\u5de5\u5177\u7684\u4f7f\u7528\uff0c\u90fd\u662f\u63d0\u5347Python\u5f00\u53d1\u6548\u7387\u7684\u91cd\u8981\u9014\u5f84\u3002\u901a\u8fc7\u4e0d\u65ad\u5b9e\u8df5\u548c\u63a2\u7d22\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u79ef\u7d2f\u4e30\u5bcc\u7684\u7ecf\u9a8c\uff0c\u63d0\u5347\u81ea\u5df1\u7684\u5f00\u53d1\u80fd\u529b\u548c\u6548\u7387\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u641c\u7d22\u53ef\u7528\u7684\u5305\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u547d\u4ee4\u6765\u641c\u7d22\u53ef\u7528\u7684\u5305\u3002\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>pip search \u5305\u540d<\/code>\uff0c\u60a8\u53ef\u4ee5\u67e5\u770b\u4e0e\u8be5\u5305\u540d\u76f8\u5173\u7684\u6240\u6709\u53ef\u7528\u5305\u53ca\u5176\u7b80\u8981\u63cf\u8ff0\u3002\u6b64\u5916\uff0c\u4e5f\u53ef\u4ee5\u8bbf\u95ee<a href=\"https:\/\/pypi.org\/\">Python Package Index (PyPI)<\/a>\u7f51\u7ad9\uff0c\u5728\u641c\u7d22\u6846\u4e2d\u8f93\u5165\u5305\u7684\u540d\u79f0\uff0c\u67e5\u627e\u76f8\u5173\u4fe1\u606f\u3002<\/p>\n<p><strong>\u5982\u4f55\u5224\u65ad\u4e00\u4e2aPython\u5305\u662f\u5426\u9002\u5408\u6211\u7684\u9879\u76ee\uff1f<\/strong><br \/>\u5728\u9009\u62e9Python\u5305\u65f6\uff0c\u53ef\u4ee5\u67e5\u770b\u5176\u6587\u6863\u3001GitHub\u9875\u9762\u3001\u7528\u6237\u8bc4\u4ef7\u4ee5\u53ca\u66f4\u65b0\u9891\u7387\u3002\u8bc4\u4f30\u5305\u7684\u6d3b\u8dc3\u5ea6\u548c\u793e\u533a\u652f\u6301\u4e5f\u5f88\u91cd\u8981\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u9009\u62e9\u90a3\u4e9b\u6709\u826f\u597d\u6587\u6863\u548c\u6d3b\u8dc3\u5f00\u53d1\u7684\u5305\u4f1a\u66f4\u52a0\u53ef\u9760\u3002\u6b64\u5916\uff0c\u67e5\u770b\u5305\u7684\u4f9d\u8d56\u5173\u7cfb\u662f\u5426\u4e0e\u60a8\u7684\u9879\u76ee\u517c\u5bb9\u4e5f\u662f\u5173\u952e\u56e0\u7d20\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u5b89\u88c5\u641c\u7d22\u5230\u7684\u5305\uff1f<\/strong><br \/>\u5b89\u88c5Python\u5305\u975e\u5e38\u7b80\u5355\u3002\u5728\u547d\u4ee4\u884c\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip install \u5305\u540d<\/code>\u547d\u4ee4\u6765\u5b89\u88c5\u60a8\u641c\u7d22\u5230\u7684\u5305\u3002\u5982\u679c\u9700\u8981\u7279\u5b9a\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip install \u5305\u540d==\u7248\u672c\u53f7<\/code>\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u5bfc\u5165\u5e76\u4f7f\u7528\u8be5\u5305\u3002\u786e\u4fdd\u5728\u5b89\u88c5\u524d\u68c0\u67e5\u8be5\u5305\u662f\u5426\u4e0e\u60a8\u7684Python\u7248\u672c\u517c\u5bb9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4e00\u3001Python\u5982\u4f55\u641c\u7d22\u5305 \u5728Python\u4e2d\uff0c\u641c\u7d22\u5305\u7684\u65b9\u5f0f\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a\u4f7f\u7528pip\u547d\u4ee4\u3001\u901a\u8fc7Anaconda [&hellip;]","protected":false},"author":3,"featured_media":942139,"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\/942135"}],"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=942135"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/942135\/revisions"}],"predecessor-version":[{"id":942142,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/942135\/revisions\/942142"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/942139"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=942135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=942135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=942135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}