{"id":70584,"date":"2024-01-31T16:04:18","date_gmt":"2024-01-31T08:04:18","guid":{"rendered":"https:\/\/docs.pingcode.com\/?p=70584"},"modified":"2024-01-31T16:04:19","modified_gmt":"2024-01-31T08:04:19","slug":"python-%e4%b8%ad%e6%9c%89%e5%93%aa%e4%ba%9b%e6%96%b9%e6%b3%95%e5%8f%af%e4%bb%a5%e6%9f%a5%e7%9c%8b-pip-%e7%9a%84%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/70584.html","title":{"rendered":"Python \u4e2d\u6709\u54ea\u4e9b\u65b9\u6cd5\u53ef\u4ee5\u67e5\u770b pip \u7684\u7248\u672c"},"content":{"rendered":"<p><strong>\u6807\u9898\uff1aPython \u4e2d\u67e5\u770b pip \u7248\u672c\u7684\u591a\u79cd\u65b9\u6cd5<\/strong><\/p>\n<p><strong>\u6458\u8981\uff1a\u901a\u8fc7\u547d\u4ee4\u884c\u67e5\u770b pip \u7248\u672c\u3001\u5728 Python \u811a\u672c\u5185\u83b7\u53d6 pip \u7248\u672c\u4fe1\u606f\u4ee5\u53ca\u901a\u8fc7Python IDE\u754c\u9762\u67e5\u770bpip\u7248\u672c\u5171\u4e09\u79cd\u4e3b\u6d41\u65b9\u6cd5\u53ef\u4ee5\u5feb\u901f\u786e\u5b9apip\u7684\u7248\u672c\u4fe1\u606f\u3002\u5176\u4e2d\uff0c\u547d\u4ee4\u884c\u65b9\u6cd5\u56e0\u5176\u76f4\u63a5\u548c\u5feb\u6377\u901a\u5e38\u6700\u4e3a\u5e38\u7528\uff0c\u5373\u6267\u884c\u201cpip &#8211;version\u201d\u6216\u201cpip -V\u201d\u4fbf\u53ef\u7acb\u523b\u5f97\u6089pip\u7248\u672c<\/strong>\u3002<\/p>\n<p>\u5728\u547d\u4ee4\u884c\u4e2d\u83b7\u53d6 pip \u7248\u672c\u7684\u65b9\u6cd5\u662f\u975e\u5e38\u76f4\u89c2\u548c\u9ad8\u6548\u7684\u3002\u7528\u6237\u4ec5\u9700\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\uff0c\u8f93\u5165\u7279\u5b9a\u6307\u4ee4\u540e\u5373\u53ef\u5f97\u5230\u76f8\u5e94\u4fe1\u606f\u3002\u6b64\u64cd\u4f5c\u5728\u591a\u4e2a\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u666e\u904d\u9002\u7528\uff0c\u4f7f\u5b83\u6210\u4e3a\u4e86\u6838\u5b9epip\u7248\u672c\u65f6\u7684\u9996\u9009\u9014\u5f84\u3002<\/p>\n<p><strong>\u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u67e5\u770b<\/strong><\/p>\n<p>\u5f53\u6d89\u53ca\u5230\u67e5\u627epip\u7248\u672c\u65f6\uff0c\u6700\u7b80\u4fbf\u7684\u65b9\u6cd5\u4fbf\u662f\u5e94\u7528\u547d\u4ee4\u884c\u5de5\u5177\u3002\u5728\u5927\u90e8\u5206\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u5305\u62ecWindows\u3001Linux\u548cMacOS\uff0c\u90fd\u53ef\u4ee5\u901a\u8fc7\u7b80\u5355\u7684\u547d\u4ee4\u7acb\u5373\u68c0\u7d22\u5230pip\u7684\u7248\u672c\u6570\u636e\u3002<\/p>\n<p>&#8211; \u5728\u547d\u4ee4\u884c\u63a5\u53e3\u8f93\u5165\u201cpip &#8211;version\u201d\u6216\u201cpip -V\u201d\uff0c\u7cfb\u7edf\u5c06\u56de\u663epip\u7684\u7248\u672c\uff0c\u540c\u65f6\u4e5f\u4f1a\u5c55\u793a\u51faPython\u7684\u7248\u672c\u4ee5\u53capip\u88ab\u5b89\u88c5\u5728\u4f55\u5904\u3002<\/p>\n<p>&#8211; \u8fd9\u79cd\u65b9\u5f0f\u6709\u4e00\u4e2a\u663e\u8457\u4f18\u70b9\uff0c\u5373\u53ef\u4ee5\u8fc5\u901f\u800c\u4e14\u65b9\u4fbf\u5730\u63d0\u4f9b\u6240\u9700\u4fe1\u606f\uff0c\u800c\u7528\u6237\u65e0\u9700\u8fdb\u5165Python\u73af\u5883\u6216\u7f16\u5199\u4efb\u4f55\u811a\u672c\u3002<\/p>\n<p><strong>\u4e8c\u3001\u5728Python\u811a\u672c\u4e2d\u68c0\u67e5<\/strong><\/p>\n<p>\u4e0d\u4ec5\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u67e5\u770bpip\u7248\u672c\uff0c\u8fd8\u53ef\u4ee5\u5728Python\u811a\u672c\u5185\u90e8\u8fdb\u884c\u68c0\u9a8c\u3002<\/p>\n<p>&#8211; \u9996\u5148\uff0c\u9700\u8981\u5bfc\u5165pip\u6a21\u5757\uff0c\u5728\u811a\u672c\u4e2d\u7f16\u5199\u4ee3\u7801\u201cimport pip\u201d\u6765\u5b9e\u73b0\u3002<\/p>\n<p>&#8211; \u63a5\u4e0b\u53bb\uff0c\u901a\u8fc7\u201cpip.__version__\u201d\u4fbf\u53ef\u4ee5\u83b7\u53d6\u5230\u7248\u672c\u53f7\uff0c\u6253\u5370\u6b64\u5c5e\u6027\u503c\u5c06\u663e\u793a\u5f53\u524d\u6240\u7528\u7684pip\u7248\u672c\u3002<\/p>\n<p>\u8fd9\u4e2a\u65b9\u6cd5\u5bf9\u4e8e\u9700\u8981\u5728Python\u7a0b\u5e8f\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u52a8\u6001\u83b7\u53d6pip\u7248\u672c\u4fe1\u606f\u7684\u573a\u666f\u7279\u522b\u6709\u7528\u3002<\/p>\n<p><strong>\u4e09\u3001\u901a\u8fc7IDE\u754c\u9762\u68c0\u7d22<\/strong><\/p>\n<p>\u5bf9\u4e8e\u90a3\u4e9b\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883(IDE)\u5982PyCharm\u8fdb\u884cPython\u5f00\u53d1\u7684\u7528\u6237\u6765\u8bf4\uff0c\u4ed6\u4eec\u53ef\u4ee5\u5728IDE\u7684\u7528\u6237\u754c\u9762\u4e2d\u67e5\u770bpip\u7248\u672c\u3002<\/p>\n<p>&#8211; \u901a\u5e38\uff0c\u53ef\u4ee5\u5728IDE\u7684\u8bbe\u7f6e\u6216\u9996\u9009\u9879\u90e8\u5206\u627e\u5230\u5173\u4e8ePython\u89e3\u91ca\u5668\u7684\u4fe1\u606f\uff0c<\/p>\n<p>\u5728\u8be5\u90e8\u5206\u901a\u5e38\u4f1a\u5217\u51fa\u5305\u62ecpip\u5728\u5185\u7684\u6240\u6709\u5305\u7684\u7248\u672c\u4fe1\u606f\u3002<\/p>\n<p>&#8211; \u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u7b80\u5355\u7684\u51e0\u6b21\u70b9\u51fb\u6765\u8bbf\u95ee\u6b64\u4fe1\u606f\uff0c\u8fd9\u4e00\u9014\u5f84\u4e5f\u5f88\u9002\u5408\u4e0d\u613f\u610f\u5207\u6362\u5230\u547d\u4ee4\u884c\u754c\u9762\u7684\u7528\u6237\u3002<\/p>\n<p>\u4e0d\u8bba\u4f60\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\uff0c\u4e86\u89e3\u5f53\u524d\u4f7f\u7528\u7684pip\u7248\u672c\u603b\u662fPython\u5f00\u53d1\u548c\u7ef4\u62a4\u4e2d\u7684\u4e00\u4e2a\u91cd\u8981\u73af\u8282\uff0c\u786e\u4fdd\u5f00\u53d1\u73af\u5883\u7684\u4e00\u81f4\u6027\u548c\u9879\u76ee\u4f9d\u8d56\u7684\u6b63\u786e\u6027\u5bf9\u4e8e\u8f6f\u4ef6\u5f00\u53d1\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<p> <strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><strong>\u5982\u4f55\u67e5\u770bpip\u7684\u7248\u672c\uff1f<\/strong><br \/>\n\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165 `pip &#8211;version` \u6765\u67e5\u770b\u5b89\u88c5\u7684pip\u7684\u7248\u672c\u4fe1\u606f\u3002<br \/>\n<strong>\u5982\u4f55\u786e\u8ba4pip\u662f\u5426\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\uff1f<\/strong><br \/>\n\u8981\u786e\u8ba4pip\u662f\u5426\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165 `pip &#8211;version` \u6216\u8005 `pip -V` \u8fd9\u4e24\u4e2a\u547d\u4ee4\u6765\u68c0\u67e5\u3002<br \/>\n<strong>\u9664\u4e86\u547d\u4ee4\u884c\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u4ec0\u4e48\u65b9\u5f0f\u6765\u67e5\u770bpip\u7684\u7248\u672c\uff1f<\/strong><br \/>\n\u9664\u4e86\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528\u547d\u4ee4\u6765\u67e5\u770bpip\u7684\u7248\u672c\uff0c\u8fd8\u53ef\u4ee5\u5728Python\u4ea4\u4e92\u5f0f\u73af\u5883\u4e2d\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u6765\u67e5\u770b `import pip; print(pip.__version__)` \u6216\u8005 `import pip; print(pip.__path__)` \u6765\u67e5\u770b\u7248\u672c\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u6807\u9898\uff1aPython \u4e2d\u67e5\u770b pip \u7248\u672c\u7684\u591a\u79cd\u65b9\u6cd5 \u6458\u8981\uff1a\u901a\u8fc7\u547d\u4ee4\u884c\u67e5\u770b pip \u7248\u672c\u3001\u5728 Python \u811a\u672c [&hellip;]","protected":false},"author":1,"featured_media":70588,"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\/70584"}],"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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=70584"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/70584\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/70588"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=70584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=70584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=70584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}