{"id":52175,"date":"2024-10-09T00:26:21","date_gmt":"2024-10-08T16:26:21","guid":{"rendered":"https:\/\/server.hk\/cnblog\/52175\/"},"modified":"2024-11-14T10:40:03","modified_gmt":"2024-11-14T02:40:03","slug":"ubuntu-%e9%96%8b%e7%99%bc%e8%80%85%e5%b0%87-python-2-%e9%99%8d%e7%b4%9a%e7%82%ba-ubuntu-18-04-lts-%e7%9a%84-universe-%e5%ad%98%e5%84%b2%e5%ba%ab","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/52175\/","title":{"rendered":"Ubuntu \u958b\u767c\u8005\u5c07 Python 2 \u964d\u7d1a\u70ba Ubuntu 18.04 LTS \u7684 \u201cUniverse\u201d \u5b58\u5132\u5eab"},"content":{"rendered":"<h1 id=\"ubuntu-%e9%96%8b%e7%99%bc%e8%80%85%e5%b0%87-python-2-%e9%99%8d%e7%b4%9a%e7%82%ba-ubuntu-18-04-lts-%e7%9a%84-universe-%e5%ad%98%e5%84%b2%e5%ba%ab-XVQAlRVwIZ\">Ubuntu \u958b\u767c\u8005\u5c07 Python 2 \u964d\u7d1a\u70ba Ubuntu 18.04 LTS \u7684 \u201cUniverse\u201d \u5b58\u5132\u5eab<\/h1>\n<p>\u5728\u958b\u6e90\u793e\u7fa4\u4e2d\uff0cPython 2 \u7684\u5730\u4f4d\u66fe\u7d93\u662f\u7121\u53ef\u66ff\u4ee3\u7684\u3002\u7136\u800c\uff0c\u96a8\u8457 Python 3 \u7684\u63a8\u51fa\u53ca\u5176\u9010\u6f38\u6210\u70ba\u4e3b\u6d41\uff0cPython 2 \u7684\u4f7f\u7528\u9010\u6f38\u6e1b\u5c11\u3002Ubuntu \u958b\u767c\u8005\u5728\u9019\u4e00\u80cc\u666f\u4e0b\uff0c\u6c7a\u5b9a\u5c07 Python 2 \u964d\u7d1a\u70ba Ubuntu 18.04 LTS \u7684 \u201cUniverse\u201d \u5b58\u5132\u5eab\uff0c\u9019\u4e00\u6c7a\u7b56\u5f15\u767c\u4e86\u5ee3\u6cdb\u7684\u8a0e\u8ad6\u3002<\/p>\n<h2 id=\"python-2-%e7%9a%84%e6%ad%b7%e5%8f%b2%e8%88%87%e7%8f%be%e7%8b%80-XVQAlRVwIZ\">Python 2 \u7684\u6b77\u53f2\u8207\u73fe\u72c0<\/h2>\n<p>Python 2 \u65bc 2000 \u5e74\u9996\u6b21\u767c\u5e03\uff0c\u4e26\u8fc5\u901f\u6210\u70ba\u8a31\u591a\u958b\u767c\u8005\u7684\u9996\u9078\u8a9e\u8a00\u3002\u96a8\u8457\u6642\u9593\u7684\u63a8\u79fb\uff0cPython 3 \u65bc 2008 \u5e74\u63a8\u51fa\uff0c\u4e26\u5f15\u5165\u4e86\u8a31\u591a\u65b0\u7279\u6027\u548c\u6539\u9032\u3002\u7136\u800c\uff0cPython 2 \u7684\u517c\u5bb9\u6027\u554f\u984c\u4f7f\u5f97\u8a31\u591a\u820a\u6709\u9805\u76ee\u7121\u6cd5\u8f15\u6613\u9077\u79fb\u5230 Python 3\u3002\u6700\u7d42\uff0cPython \u5b98\u65b9\u65bc 2020 \u5e74 1 \u6708 1 \u65e5\u505c\u6b62\u4e86\u5c0d Python 2 \u7684\u652f\u6301\uff0c\u9019\u4f7f\u5f97\u8a31\u591a\u4f9d\u8cf4\u65bc Python 2 \u7684\u61c9\u7528\u7a0b\u5e8f\u9762\u81e8\u6311\u6230\u3002<\/p>\n<h2 id=\"ubuntu-18-04-lts-%e7%9a%84-universe-%e5%ad%98%e5%84%b2%e5%ba%ab-XVQAlRVwIZ\">Ubuntu 18.04 LTS \u7684 \u201cUniverse\u201d \u5b58\u5132\u5eab<\/h2>\n<p>Ubuntu 18.04 LTS\uff08Bionic Beaver\uff09\u662f Ubuntu \u7684\u4e00\u500b\u9577\u671f\u652f\u6301\u7248\u672c\uff0c\u65bc 2018 \u5e74 4 \u6708\u767c\u5e03\u3002\u8a72\u7248\u672c\u7684 \u201cUniverse\u201d \u5b58\u5132\u5eab\u5305\u542b\u4e86\u793e\u7fa4\u7dad\u8b77\u7684\u8edf\u4ef6\u5305\uff0c\u9019\u4e9b\u5305\u7684\u652f\u6301\u548c\u66f4\u65b0\u4e26\u4e0d\u5982 \u201cMain\u201d \u5b58\u5132\u5eab\u4e2d\u7684\u5305\u90a3\u6a23\u7a69\u5b9a\u3002\u5c07 Python 2 \u964d\u7d1a\u81f3 \u201cUniverse\u201d \u5b58\u5132\u5eab\u610f\u5473\u8457 Ubuntu \u5c07\u4e0d\u518d\u4e3b\u52d5\u7dad\u8b77 Python 2\uff0c\u4e26\u4e14\u7528\u6236\u9700\u8981\u81ea\u884c\u627f\u64d4\u4f7f\u7528\u8a72\u8a9e\u8a00\u7684\u98a8\u96aa\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bd%95%e9%81%b8%e6%93%87%e9%99%8d%e7%b4%9a-python-2-XVQAlRVwIZ\">\u70ba\u4f55\u9078\u64c7\u964d\u7d1a Python 2<\/h2>\n<ul>\n<li><strong>\u8cc7\u6e90\u5206\u914d\uff1a<\/strong>\u96a8\u8457\u958b\u767c\u8005\u5c07\u91cd\u5fc3\u8f49\u5411 Python 3\uff0c\u7dad\u8b77 Python 2 \u7684\u8cc7\u6e90\u8b8a\u5f97\u8d8a\u4f86\u8d8a\u6709\u9650\u3002\u5c07\u5176\u964d\u7d1a\u81f3 \u201cUniverse\u201d \u5b58\u5132\u5eab\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c08\u6ce8\u65bc\u66f4\u73fe\u4ee3\u7684\u6280\u8853\u3002<\/li>\n<li><strong>\u5b89\u5168\u6027\u8003\u91cf\uff1a<\/strong>Python 2 \u7684\u505c\u6b62\u652f\u6301\u610f\u5473\u8457\u4e0d\u6703\u518d\u6709\u5b89\u5168\u66f4\u65b0\uff0c\u9019\u5c0d\u65bc\u4f9d\u8cf4\u8a72\u8a9e\u8a00\u7684\u61c9\u7528\u7a0b\u5e8f\u4f86\u8aaa\u662f\u4e00\u500b\u6f5b\u5728\u7684\u5b89\u5168\u96b1\u60a3\u3002<\/li>\n<li><strong>\u63a8\u52d5\u9077\u79fb\uff1a<\/strong>\u964d\u7d1a Python 2 \u4e5f\u53ef\u4ee5\u4fc3\u4f7f\u958b\u767c\u8005\u66f4\u5feb\u5730\u5c07\u5176\u61c9\u7528\u7a0b\u5e8f\u9077\u79fb\u5230 Python 3\uff0c\u5f9e\u800c\u5229\u7528\u65b0\u7248\u672c\u7684\u512a\u52e2\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e5%9c%a8-ubuntu-18-04-lts-%e4%b8%ad%e4%bd%bf%e7%94%a8-python-2-XVQAlRVwIZ\">\u5982\u4f55\u5728 Ubuntu 18.04 LTS \u4e2d\u4f7f\u7528 Python 2<\/h2>\n<p>\u5118\u7ba1 Python 2 \u88ab\u964d\u7d1a\uff0c\u4f46\u4ecd\u7136\u53ef\u4ee5\u5728 Ubuntu 18.04 LTS \u4e2d\u5b89\u88dd\u548c\u4f7f\u7528\u3002\u7528\u6236\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88dd Python 2\uff1a<\/p>\n<pre><code>sudo apt update\nsudo apt install python2<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u7528\u6236\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5 Python 2 \u7684\u7248\u672c\uff1a<\/p>\n<pre><code>python2 --version<\/code><\/pre>\n<p>\u7136\u800c\uff0c\u958b\u767c\u8005\u61c9\u8a72\u6ce8\u610f\uff0c\u4f7f\u7528 Python 2 \u53ef\u80fd\u6703\u9762\u81e8\u8a31\u591a\u6311\u6230\uff0c\u5305\u62ec\u7f3a\u4e4f\u652f\u6301\u548c\u5b89\u5168\u6027\u554f\u984c\u3002\u56e0\u6b64\uff0c\u5efa\u8b70\u7528\u6236\u5118\u65e9\u8003\u616e\u5c07\u5176\u61c9\u7528\u7a0b\u5e8f\u9077\u79fb\u5230 Python 3\u3002<\/p>\n<h2 id=\"%e7%b5%90%e8%ab%96-XVQAlRVwIZ\">\u7d50\u8ad6<\/h2>\n<p>Ubuntu \u958b\u767c\u8005\u5c07 Python 2 \u964d\u7d1a\u70ba Ubuntu 18.04 LTS \u7684 \u201cUniverse\u201d \u5b58\u5132\u5eab\uff0c\u53cd\u6620\u4e86\u958b\u6e90\u793e\u7fa4\u5c0d\u65bc\u6280\u8853\u9032\u6b65\u7684\u91cd\u8996\u3002\u96d6\u7136\u9019\u4e00\u6c7a\u7b56\u53ef\u80fd\u6703\u5c0d\u67d0\u4e9b\u7528\u6236\u9020\u6210\u4e0d\u4fbf\uff0c\u4f46\u5b83\u540c\u6642\u4e5f\u4fc3\u9032\u4e86\u66f4\u73fe\u4ee3\u6280\u8853\u7684\u63a1\u7528\u3002\u5c0d\u65bc\u4f9d\u8cf4 Python 2 \u7684\u958b\u767c\u8005\u4f86\u8aaa\uff0c\u73fe\u5728\u662f\u6642\u5019\u8003\u616e\u9077\u79fb\u5230 Python 3\uff0c\u4ee5\u78ba\u4fdd\u61c9\u7528\u7a0b\u5e8f\u7684\u5b89\u5168\u6027\u548c\u7a69\u5b9a\u6027\u3002<\/p>\n<p>\u5982\u9700\u4e86\u89e3\u66f4\u591a\u6709\u95dc <a href=\"https:\/\/server.hk\">VPS<\/a> \u548c\u5176\u4ed6\u4f3a\u670d\u5668\u89e3\u6c7a\u65b9\u6848\u7684\u4fe1\u606f\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu 18.04 LTS\u5c07Python 2\u964d\u7d1a\u81f3\u201cUniverse\u201d\u5b58\u5132\u5eab\uff0c\u5f71\u97ff\u958b\u767c\u8005\u548c\u7528\u6236\u7684\u61c9\u7528\u7a0b\u5e8f\u517c\u5bb9\u6027\u8207\u652f\u6301\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-52175","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/52175","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=52175"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/52175\/revisions"}],"predecessor-version":[{"id":52176,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/52175\/revisions\/52176"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=52175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=52175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=52175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}