{"id":204545,"date":"2025-05-29T13:33:07","date_gmt":"2025-05-29T05:33:07","guid":{"rendered":"https:\/\/server.hk\/cnblog\/204545\/"},"modified":"2025-05-29T13:33:07","modified_gmt":"2025-05-29T05:33:07","slug":"python-%e5%ae%89%e8%a3%85-requests-%e5%ba%93%e6%97%b6%e6%8f%90%e7%a4%ba%e9%94%99%e8%af%af%ef%bc%9a%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3-unknown-command-install-upgrade-%e9%97%ae","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/204545\/","title":{"rendered":"Python \u5b89\u88c5 requests \u5e93\u65f6\u63d0\u793a\u9519\u8bef\uff1a\u5982\u4f55\u89e3\u51b3 \\&#8221;unknown command \\&#8221;install-upgrade\\&#8221;\\&#8221; \u95ee\u9898\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Python \u5b89\u88c5 requests \u5e93\u65f6\u63d0\u793a\u9519\u8bef\uff1a\u5982\u4f55\u89e3\u51b3 \\&#8221;unknown command \\&#8221;install-upgrade\\&#8221;\\&#8221; \u95ee\u9898\uff1f<\/h1>\n<p>\u77e5\u8bc6\u70b9\u638c\u63e1\u4e86\uff0c\u8fd8\u9700\u8981\u4e0d\u65ad\u7ec3\u4e60\u624d\u80fd\u719f\u7ec3\u8fd0\u7528\u3002\u4e0b\u9762\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u4e2a\u6587\u7ae0\u5f00\u53d1\u5b9e\u6218\uff0c\u624b\u628a\u624b\u6559\u5927\u5bb6\u5b66\u4e60\u300aPython \u5b89\u88c5 requests \u5e93\u65f6\u63d0\u793a\u9519\u8bef\uff1a\u5982\u4f55\u89e3\u51b3 \\&#8221;unknown command \\&#8221;install-upgrade\\&#8221;\\&#8221; \u95ee\u9898\uff1f\u300b\uff0c\u5728\u5b9e\u73b0\u529f\u80fd\u7684\u8fc7\u7a0b\u4e2d\u4e5f\u5e26\u5927\u5bb6\u91cd\u65b0\u6e29\u4e60\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6e29\u6545\u800c\u77e5\u65b0\uff0c\u56de\u5934\u770b\u770b\u8bf4\u4e0d\u5b9a\u53c8\u6709\u4e0d\u4e00\u6837\u7684\u611f\u609f\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241110\/173121394467303a78599a0.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>python \u5b89\u88c5 requests \u5e93\u65f6\u63d0\u793a\u9519\u8bef<\/strong><\/p>\n<p>\u5728\u901a\u8fc7\u547d\u4ee4\u884c\u5b89\u88c5 requests \u5e93\u65f6\uff0c\u4f60\u53ef\u80fd\u9047\u5230\u8fd9\u6837\u7684\u9519\u8bef\u63d0\u793a\uff1a<\/p>\n<pre>\u60a8\u4f7f\u7528\u7684\u662fpip\u7248\u672c9.0.3\uff0c\u4f46\u662f\u7248\u672c18.0\u662f\u53ef\u7528\u7684\u3002\n\u60a8\u5e94\u8be5\u8003\u8651\u901a\u8fc7\u201cpython -m pip install\u2014upgrade pip\u201d\u547d\u4ee4\u8fdb\u884c\u5347\u7ea7\u3002<\/pre>\n<p>\u8be5\u9519\u8bef\u8868\u660e\u4f60\u7684 pip \u7248\u672c\u5df2\u8fc7\u65f6\uff0c\u9700\u8981\u5347\u7ea7\u3002\u7136\u800c\uff0c\u5728\u6309\u7167\u63d0\u793a\u8f93\u5165\u5347\u7ea7\u547d\u4ee4\uff1a<\/p>\n<pre>python -m pip install\u2014upgrade pip<\/pre>\n<p>\u540e\uff0c\u4f60\u5374\u9047\u5230\u4e86\u53e6\u4e00\u4e2a\u9519\u8bef\uff1a<\/p>\n<pre>error: unknown command \"install-upgrade\" - maybe you meant \"install\"<\/pre>\n<p>\u95ee\u9898\u51fa\u5728\u5347\u7ea7 pip \u65f6\u4f7f\u7528\u7684\u547d\u4ee4\u9519\u8bef\u3002\u6b63\u786e\u7684\u547d\u4ee4\u5e94\u8be5\u662f\uff1a<\/p>\n<pre>python -m pip install --upgrade pip<\/pre>\n<p>\u6ce8\u610f &#8220;install&#8221; \u548c &#8220;&#8211;upgrade&#8221; \u4e4b\u95f4\u4e0d\u5e94\u8be5\u6709\u7a7a\u683c\u3002\u4fee\u6539\u540e\u7684\u547d\u4ee4\u5c06\u6210\u529f\u5347\u7ea7\u4f60\u7684 pip \u7248\u672c\uff0c\u7136\u540e\u4f60\u5c31\u53ef\u4ee5\u5b89\u88c5 requests \u5e93\u4e86\u3002<\/p>\n<p>\u4eca\u5929\u5173\u4e8e\u300aPython \u5b89\u88c5 requests \u5e93\u65f6\u63d0\u793a\u9519\u8bef\uff1a\u5982\u4f55\u89e3\u51b3 \\&#8221;unknown command \\&#8221;install-upgrade\\&#8221;\\&#8221; \u95ee\u9898\uff1f\u300b\u7684\u5185\u5bb9\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\uff0c\u5982\u679c\u6709\u4ec0\u4e48\u7591\u95ee\u6216\u8005\u5efa\u8bae\uff0c\u53ef\u4ee5\u5728\u516c\u4f17\u53f7\u4e0b\u591a\u591a\u56de\u590d\u4ea4\u6d41\uff1b\u6587\u4e2d\u82e5\u6709\u4e0d\u6b63\u4e4b\u5904\uff0c\u4e5f\u5e0c\u671b\u56de\u590d\u7559\u8a00\u4ee5\u544a\u77e5\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python \u5b89\u88c5 reques&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-204545","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204545","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=204545"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204545\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=204545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=204545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=204545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}