{"id":1027,"date":"2019-10-28T22:21:30","date_gmt":"2019-10-28T14:21:30","guid":{"rendered":"http:\/\/vip.fxxkpython.com\/?p=1027"},"modified":"2020-02-15T23:16:53","modified_gmt":"2020-02-15T15:16:53","slug":"python-%e5%bf%ab%e9%80%9f%e5%85%a5%e9%97%a8-pip-%e5%b8%b8%e7%94%a8%e7%9a%84%e5%90%84%e7%a7%8d%e9%aa%9a%e6%93%8d%e4%bd%9c%e6%98%af%e6%80%8e%e6%a0%b7%e7%9a%84%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/vip.fxxkpython.com\/?p=1027","title":{"rendered":"Python \u5feb\u901f\u5165\u95e8 | pip \u5e38\u7528\u7684\u5404\u79cd\u9a9a\u64cd\u4f5c\u662f\u600e\u6837\u7684\uff1f"},"content":{"rendered":"\n<p>\u8fd9\u4e00\u7bc7\u6765\u8ddf\u4f60\u8bf4\u8bf4\u5173\u4e8e\u6a21\u5757\u7684\u5b89\u88c5\u548c\u7ba1\u7406\uff0c\u76f8\u4fe1\u4f60\u4e4b\u524d\u4e5f\u591a\u591a\u5c11\u5c11\u4e86\u89e3\u8fc7\u5b89\u88c5\u4e00\u4e2a\u7b2c\u4e09\u65b9\u6a21\u5757\uff0c\u6bd4\u5982\u4f60\u8981\u5b89\u88c5 requests \u5e93\uff0c\u90a3\u4e48\u4f60\u5e94\u8be5\u662f\u8fd9\u6837\u4e00\u987f\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>pip install requests<\/p><\/blockquote>\n\n\n\n<p>\u4e4b\u6240\u4ee5\u4f60\u53ef\u4ee5\u76f4\u63a5\u8fd9\u6837\u64cd\u4f5c\uff0c\u90a3\u662f\u56e0\u4e3a\u4f60\u7684 Python \u7248\u672c\u662f 3.4 \u4e4b\u540e\u7684\uff0c\u5728\u8fd9\u6837\u7684 Python \u7248\u672c\u91cc\u9762\uff0c\u9ed8\u8ba4\u5185\u7f6e\u4e86 pip \u8fd9\u4e2a\u5de5\u5177\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b83\u76f4\u63a5\u6765\u5b89\u88c5\u6216\u8005\u7ba1\u7406\u4e00\u4e9b\u7b2c\u4e09\u65b9\u5e93\u3002<\/p>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528 pip &#8211;version \u6765\u770b\u770b\u4f60\u662f\u5426\u5b89\u88c5\u4e86 pip \uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"734\" height=\"488\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2019\/10\/Screenshot-from-2019-10-28-19-47-32.png\" alt=\"\" class=\"wp-image-1028\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2019\/10\/Screenshot-from-2019-10-28-19-47-32.png 734w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2019\/10\/Screenshot-from-2019-10-28-19-47-32-300x199.png 300w\" sizes=\"(max-width: 734px) 100vw, 734px\" \/><\/figure>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5728\u8fd9\u91cc\u7684 Python 2.7 \u548c 3.8 \u7248\u672c\u90fd\u6709\u4e86 pip \uff0c\u5982\u679c\u4f60\u5728 Python 3.4 \u4e4b\u524d\u7684\u7248\u672c\u53d1\u73b0\u6ca1\u6709 pip \uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u542f\u52a8\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>python -m ensurepip &#8211;default-pip <br><br><\/p><\/blockquote>\n\n\n\n<p>\u5982\u679c\u4f60\u60f3\u66f4\u65b0\u4f60\u7684 pip \u5230\u6700\u65b0\u7248\u672c\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u8fd9\u6837\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"725\" height=\"143\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2019\/10\/Screenshot-from-2019-10-28-19-53-34.png\" alt=\"\" class=\"wp-image-1029\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2019\/10\/Screenshot-from-2019-10-28-19-53-34.png 725w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2019\/10\/Screenshot-from-2019-10-28-19-53-34-300x59.png 300w\" sizes=\"(max-width: 725px) 100vw, 725px\" \/><\/figure><\/div>\n\n\n\n<p>\u5efa\u8bae\u4f60\u90fd\u66f4\u65b0\u5230\u6700\u65b0\u7684\u7248\u672c\u6765\uff0c\u786e\u4fdd\u4f60\u80fd\u66f4\u597d\u7684\u53bb\u5b89\u88c5\u548c\u7ba1\u7406\u4e00\u4e9b\u7b2c\u4e09\u65b9\u5e93\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u662f ubuntu \u7cfb\u7edf\uff0c\u5728\u5347\u7ea7\u540e\u4f7f\u7528 pip \u53d1\u73b0\u9519\u8bef\uff0c\u53ef\u4ee5\u4fee\u6539\u4e00\u4e0b \/usr\/bin\/pip \u7684\u5185\u5bb9\uff0c\u5c06\u539f\u6765\u7684\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>from pip import main<br><br>if __name__ == &#8216;__main__&#8217;:<br>    sys.exit(main())<\/p><\/blockquote>\n\n\n\n<p>\u6539\u6210\u8fd9\u6837\u5373\u53ef\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>from pip import<strong> __main__<\/strong><br><br>if __name__ == &#8216;__main__&#8217;:<br>    sys.exit(<strong>__main__._main()<\/strong>)<\/p><\/blockquote>\n\n\n\n<h4 id=\"mce_32\">\u5982\u4f55\u5728\u4e0d\u540c\u7684\u7248\u672c\u4e2d\u5b89\u88c5\u6a21\u5757<\/h4>\n\n\n\n<p>\u4e00\u822c\u6765\u8bf4\uff0c\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u6709\u591a\u4e2a Python \u7248\u672c\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7 pip \u548c pip3 \u6765\u6307\u5b9a\u5b89\u88c5 \u201c\u7b2c\u4e09\u65b9\u5e93\u201d \u5230\u4e0d\u540c\u7684\u7248\u672c\u4e2d\u53bb\uff0c\u6bd4\u5982\u4f60\u5b89\u88c5 requests \u5e93\u5230\u4e0d\u540c\u7248\u672c\u7684 Python \u4e2d\uff0c\u90a3\u4e48\u53ef\u4ee5\u8fd9\u6837\uff1a<div style=\"text-align:center;border:1px dashed #FF9A9A;padding:8px;margin:10px auto;color:#FF6666;\">\u672c\u6587\u9690\u85cf\u5185\u5bb9 <a href=\"https:\/\/vip.fxxkpython.com\/wp-login.php?redirect_to=https%3A%2F%2Fvip.fxxkpython.com%2F%3Fp%3D1027\">\u767b\u9646<\/a> \u540e\u624d\u53ef\u4ee5\u6d4f\u89c8<\/div>ok\uff0c\u4ee5\u4e0a\u5c31\u662f pip \u5e38\u7528\u7684\u64cd\u4f5c\u4e86\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6211\u4e4b\u524d\u8fd8\u5728\u516c\u4f17\u53f7\u5199\u8fc7\u5982\u4f55\u4e0a\u4f20\u6a21\u5757\u5230 pypi \u7ed9\u522b\u4eba\u5b89\u88c5\uff0c\u8be6\u60c5\u53ef\u6233\uff1a <a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU2ODYzNTkwMg==&amp;mid=2247485028&amp;idx=1&amp;sn=020fb77e5c22402ac2231aabc6391122&amp;chksm=fc8bbef5cbfc37e3b1dfece8ad6397e0ad9cad791a6d98cd213b772a3ff376fc123db8c319f5&amp;token=943701633&amp;lang=zh_CN#rd\">\u6559\u4f60\u88c5\u903c\u4e86\uff1a\u600e\u4e48\u6837\u53d1\u5e03\u4f60\u7684 Python \u4ee3\u7801\u7ed9\u522b\u4eba \u201cpip install\u201d<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e00\u7bc7\u6765\u8ddf\u4f60\u8bf4\u8bf4\u5173\u4e8e\u6a21\u5757\u7684\u5b89\u88c5\u548c\u7ba1\u7406\uff0c\u76f8\u4fe1\u4f60\u4e4b\u524d\u4e5f\u591a\u591a\u5c11\u5c11\u4e86\u89e3\u8fc7\u5b89\u88c5\u4e00\u4e2a\u7b2c\u4e09\u65b9\u6a21\u5757\uff0c\u6bd4\u5982\u4f60\u8981\u5b89\u88c5 requests \u5e93\uff0c\u90a3\u4e48\u4f60\u5e94\u8be5\u662f\u8fd9\u6837\u4e00\u987f\u64cd\u4f5c\uff1a pip install requests \u4e4b\u6240\u4ee5\u4f60\u53ef\u4ee5\u76f4\u63a5\u8fd9\u6837\u64cd\u4f5c\uff0c\u90a3\u662f\u56e0\u4e3a\u4f60\u7684 Python \u7248\u672c\u662f&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"tags":[137,138,136,19,20,139],"_links":{"self":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/1027"}],"collection":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1027"}],"version-history":[{"count":5,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/1027\/revisions"}],"predecessor-version":[{"id":3881,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/1027\/revisions\/3881"}],"wp:attachment":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}