{"id":473,"date":"2025-01-14T07:43:38","date_gmt":"2025-01-13T23:43:38","guid":{"rendered":"http:\/\/sqtcw.cn\/?p=473"},"modified":"2025-01-14T07:43:38","modified_gmt":"2025-01-13T23:43:38","slug":"python%e6%80%8e%e4%b9%88%e6%a3%80%e6%9f%a5pip%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"http:\/\/www.cnitw.com\/?p=473","title":{"rendered":"Python\u600e\u4e48\u68c0\u67e5pip\u7248\u672c"},"content":{"rendered":"\n<p>\u4ee5\u4e0b\u662f\u51e0\u79cd\u68c0\u67e5 <code>pip<\/code> \u7248\u672c\u7684\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<p><strong>\u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u884c<\/strong><br>\u5728\u547d\u4ee4\u884c\u7ec8\u7aef\u4e2d\uff0c\u76f4\u63a5\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip --version<\/code><\/pre>\n\n\n\n<p>\u6216\u8005\uff0c\u5982\u679c\u4f7f\u7528\u7684\u662f Python 3 \u7684 <code>pip<\/code>\uff0c\u53ef\u4ee5\u4f7f\u7528\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip3 --version<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u663e\u793a <code>pip<\/code> \u7684\u7248\u672c\u4fe1\u606f\uff0c\u5305\u62ec <code>pip<\/code> \u7684\u7248\u672c\u53f7\u3001<code>Python<\/code> \u7684\u7248\u672c\u53f7\u548c <code>pip<\/code> \u6240\u5728\u7684\u8def\u5f84\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u4f1a\u770b\u5230\u5982\u4e0b\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip 22.3.1 from \/usr\/local\/lib\/python3.10\/site-packages\/pip (python 3.10)<\/code><\/pre>\n\n\n\n<p><strong>\u4e8c\u3001\u5728 Python \u811a\u672c\u4e2d\u68c0\u67e5<\/strong><br>\u4f60\u4e5f\u53ef\u4ee5\u5728 Python \u811a\u672c\u4e2d\u4f7f\u7528 <code>pip<\/code> \u7684 <code>__version__<\/code> \u5c5e\u6027\u6765\u68c0\u67e5 <code>pip<\/code> \u7684\u7248\u672c\uff0c\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pip\n\nprint(pip.__version__)<\/code><\/pre>\n\n\n\n<p>\u5728\u8fd9\u4e2a\u4ee3\u7801\u4e2d\uff0c\u5bfc\u5165 <code>pip<\/code> \u5e93\uff0c\u7136\u540e\u4f7f\u7528 <code>pip.__version__<\/code> \u5c5e\u6027\u6253\u5370\u51fa <code>pip<\/code> \u7684\u7248\u672c\u53f7\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u53ef\u80fd\u4f1a\u56e0\u4e3a\u6743\u9650\u95ee\u9898\u800c\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff0c\u56e0\u4e3a <code>pip<\/code> \u901a\u5e38\u662f\u4e00\u4e2a\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u800c\u4e0d\u662f\u8bbe\u8ba1\u4e3a\u5728\u811a\u672c\u4e2d\u4f7f\u7528\u7684\u5e93\u3002<\/p>\n\n\n\n<p><strong>\u4e09\u3001\u4f7f\u7528 <code>pip -V<\/code> \u547d\u4ee4\uff08\u7b49\u6548\u4e8e <code>pip --version<\/code>\uff09<\/strong><br>\u53e6\u4e00\u79cd\u547d\u4ee4\u884c\u68c0\u67e5 <code>pip<\/code> \u7248\u672c\u7684\u65b9\u5f0f\u662f\u4f7f\u7528\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip -V<\/code><\/pre>\n\n\n\n<p>\u5b83\u4e0e <code>pip --version<\/code> \u7684\u529f\u80fd\u76f8\u540c\uff0c\u4f1a\u8f93\u51fa <code>pip<\/code> \u7684\u7248\u672c\u4fe1\u606f\u3002<\/p>\n\n\n\n<p>\u65e0\u8bba\u4f7f\u7528\u54ea\u79cd\u65b9\u6cd5\uff0c\u90fd\u53ef\u4ee5\u65b9\u4fbf\u5730\u67e5\u770b <code>pip<\/code> \u7684\u5f53\u524d\u7248\u672c\u3002\u4e86\u89e3 <code>pip<\/code> \u7684\u7248\u672c\u5bf9\u4e8e\u7ba1\u7406 Python \u5305\u662f\u5f88\u91cd\u8981\u7684\uff0c\u56e0\u4e3a\u4e0d\u540c\u7684 <code>pip<\/code> \u7248\u672c\u53ef\u80fd\u4f1a\u6709\u4e0d\u540c\u7684\u7279\u6027\u548c\u884c\u4e3a\uff0c\u5e76\u4e14\u67d0\u4e9b\u5305\u53ef\u80fd\u9700\u8981\u7279\u5b9a\u7248\u672c\u7684 <code>pip<\/code> \u624d\u80fd\u6b63\u786e\u5b89\u88c5\u548c\u4f7f\u7528\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u53d1\u73b0 <code>pip<\/code> \u7684\u7248\u672c\u8f83\u65e7\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u66f4\u65b0\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install --upgrade pip<\/code><\/pre>\n\n\n\n<p>\u6216\u8005\u5bf9\u4e8e Python 3 \u7684 <code>pip<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip3 install --upgrade pip<\/code><\/pre>\n\n\n\n<p>\u66f4\u65b0 <code>pip<\/code> \u53ef\u4ee5\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u6700\u65b0\u7684\u529f\u80fd\u548c\u7279\u6027\uff0c\u66f4\u597d\u5730\u7ba1\u7406 Python \u5305\uff0c\u540c\u65f6\u89e3\u51b3\u4e00\u4e9b\u56e0 <code>pip<\/code> \u7248\u672c\u8f83\u65e7\u800c\u53ef\u80fd\u51fa\u73b0\u7684\u5b89\u88c5\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u5728\u4f7f\u7528 <code>pip<\/code> \u547d\u4ee4\u65f6\uff0c\u8bf7\u786e\u4fdd\u4f60\u5177\u6709\u76f8\u5e94\u7684\u6743\u9650\uff0c\u5c24\u5176\u662f\u5728\u7cfb\u7edf\u7ea7\u522b\u7684 Python \u5b89\u88c5\u4e2d\uff0c\u53ef\u80fd\u9700\u8981\u7ba1\u7406\u5458\u6743\u9650\u624d\u80fd\u8fdb\u884c\u66f4\u65b0\u64cd\u4f5c\u3002\u5982\u679c\u4f7f\u7528\u865a\u62df\u73af\u5883\uff0c\u53ef\u4ee5\u5728\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\u76f4\u63a5\u4f7f\u7528 <code>pip<\/code> \u547d\u4ee4\uff0c\u65e0\u9700\u989d\u5916\u7684\u6743\u9650\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0b\u662f\u51e0\u79cd\u68c0\u67e5 pip \u7248\u672c\u7684\u65b9\u6cd5\uff1a \u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u5728\u547d\u4ee4\u884c\u7ec8\u7aef\u4e2d\uff0c\u76f4\u63a5\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a \u6216\u8005\uff0c\u5982\u679c\u4f7f\u7528\u7684\u662f Python 3 \u7684 pip\uff0c\u53ef\u4ee5\u4f7f\u7528\uff1a \u8fd9\u4e2a\u547d\u4ee4\u4f1a\u663e\u793a pip \u7684\u7248\u672c\u4fe1\u606f\uff0c\u5305\u62ec pip \u7684\u7248\u672c\u53f7\u3001Python \u7684\u7248\u672c\u53f7\u548c pip \u6240\u5728\u7684\u8def\u5f84\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u4f1a\u770b\u5230\u5982\u4e0b\u8f93\u51fa\uff1a \u4e8c\u3001\u5728 Python \u811a\u672c\u4e2d\u68c0\u67e5\u4f60\u4e5f\u53ef\u4ee5\u5728 Python \u811a\u672c\u4e2d\u4f7f\u7528 pip \u7684 __version__ \u5c5e\u6027\u6765\u68c0\u67e5 pip \u7684\u7248\u672c\uff0c\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a \u5728\u8fd9\u4e2a\u4ee3\u7801\u4e2d\uff0c\u5bfc\u5165 pip&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-473","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"http:\/\/www.cnitw.com\/index.php?rest_route=\/wp\/v2\/posts\/473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.cnitw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cnitw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cnitw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cnitw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=473"}],"version-history":[{"count":0,"href":"http:\/\/www.cnitw.com\/index.php?rest_route=\/wp\/v2\/posts\/473\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.cnitw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cnitw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=473"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cnitw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}