{"id":51871,"date":"2024-10-08T22:10:16","date_gmt":"2024-10-08T14:10:16","guid":{"rendered":"https:\/\/server.hk\/cnblog\/51871\/"},"modified":"2024-11-14T10:41:25","modified_gmt":"2024-11-14T02:41:25","slug":"ubuntu-20-04-lts-%e7%b9%bc%e7%ba%8c%e8%87%b4%e5%8a%9b%e6%96%bc%e7%a7%bb%e9%99%a4-python-2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/51871\/","title":{"rendered":"Ubuntu 20.04 LTS \u7e7c\u7e8c\u81f4\u529b\u65bc\u79fb\u9664 Python 2"},"content":{"rendered":"<h1 id=\"ubuntu-20-04-lts-%e7%b9%bc%e7%ba%8c%e8%87%b4%e5%8a%9b%e6%96%bc%e7%a7%bb%e9%99%a4-python-2-tzvXxKgOtO\">Ubuntu 20.04 LTS \u7e7c\u7e8c\u81f4\u529b\u65bc\u79fb\u9664 Python 2<\/h1>\n<p>\u5728\u958b\u6e90\u793e\u7fa4\u4e2d\uff0cPython \u662f\u4e00\u7a2e\u5ee3\u6cdb\u4f7f\u7528\u7684\u7a0b\u5f0f\u8a9e\u8a00\uff0c\u56e0\u5176\u7c21\u55ae\u6613\u5b78\u548c\u5f37\u5927\u7684\u529f\u80fd\u800c\u53d7\u5230\u958b\u767c\u8005\u7684\u9752\u775e\u3002\u7136\u800c\uff0c\u96a8\u8457\u6280\u8853\u7684\u9032\u6b65\uff0cPython 2 \u7684\u4f7f\u7528\u9010\u6f38\u88ab\u6dd8\u6c70\uff0cUbuntu 20.04 LTS \u7684\u63a8\u51fa\u6a19\u8a8c\u8457\u9019\u4e00\u904e\u7a0b\u7684\u9032\u4e00\u6b65\u63a8\u9032\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-tzvXxKgOtO\">Python 2 \u7684\u6b77\u53f2\u8207\u73fe\u72c0<\/h2>\n<p>Python 2 \u65bc 2000 \u5e74\u9996\u6b21\u767c\u5e03\uff0c\u4e26\u5728\u96a8\u5f8c\u7684\u5e7e\u5e74\u4e2d\u8fc5\u901f\u7372\u5f97\u4e86\u5ee3\u6cdb\u7684\u61c9\u7528\u3002\u7136\u800c\uff0c\u96a8\u8457 Python 3 \u7684\u63a8\u51fa\uff0cPython 2 \u7684\u652f\u6301\u9010\u6f38\u6e1b\u5c11\u3002Python \u5b98\u65b9\u65bc 2020 \u5e74 1 \u6708 1 \u65e5\u6b63\u5f0f\u505c\u6b62\u5c0d Python 2 \u7684\u652f\u6301\uff0c\u9019\u610f\u5473\u8457\u4e0d\u518d\u63d0\u4f9b\u4efb\u4f55\u5b89\u5168\u66f4\u65b0\u6216\u4fee\u5fa9\u3002<\/p>\n<p>\u9019\u4e00\u8b8a\u5316\u4fc3\u4f7f\u8a31\u591a Linux \u767c\u884c\u7248\uff0c\u5305\u62ec Ubuntu\uff0c\u958b\u59cb\u9010\u6b65\u79fb\u9664 Python 2\u3002Ubuntu 20.04 LTS \u662f\u4e00\u500b\u9577\u671f\u652f\u6301\u7248\u672c\uff0c\u65e8\u5728\u63d0\u4f9b\u7a69\u5b9a\u548c\u5b89\u5168\u7684\u74b0\u5883\uff0c\u56e0\u6b64\u5b83\u7684\u958b\u767c\u5718\u968a\u6c7a\u5b9a\u4e0d\u518d\u9810\u88dd Python 2\u3002<\/p>\n<h2 id=\"ubuntu-20-04-lts-%e7%9a%84%e8%ae%8a%e5%8c%96-tzvXxKgOtO\">Ubuntu 20.04 LTS \u7684\u8b8a\u5316<\/h2>\n<p>\u5728 Ubuntu 20.04 LTS \u4e2d\uff0cPython 3 \u6210\u70ba\u4e86\u9810\u8a2d\u7684 Python \u7248\u672c\u3002\u9019\u4e00\u6539\u8b8a\u4e0d\u50c5\u63d0\u9ad8\u4e86\u7cfb\u7d71\u7684\u5b89\u5168\u6027\uff0c\u9084\u4fc3\u9032\u4e86\u958b\u767c\u8005\u8f49\u5411\u4f7f\u7528 Python 3 \u7684\u65b0\u7279\u6027\u548c\u6539\u9032\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4e3b\u8981\u7684\u8b8a\u5316\uff1a<\/p>\n<ul>\n<li><strong>\u9810\u8a2d\u7248\u672c\u8b8a\u66f4\uff1a<\/strong>Ubuntu 20.04 LTS \u9810\u88dd Python 3.8\uff0c\u4e26\u5c07\u5176\u8a2d\u70ba\u7cfb\u7d71\u7684\u9810\u8a2d Python \u7248\u672c\u3002<\/li>\n<li><strong>\u79fb\u9664 Python 2\uff1a<\/strong>\u7cfb\u7d71\u4e2d\u4e0d\u518d\u5305\u542b Python 2\uff0c\u9019\u610f\u5473\u8457\u7528\u6236\u9700\u8981\u624b\u52d5\u5b89\u88dd Python 2\uff0c\u4e26\u4e14\u5728\u672a\u4f86\u7684\u66f4\u65b0\u4e2d\u53ef\u80fd\u4e0d\u6703\u518d\u5f97\u5230\u652f\u6301\u3002<\/li>\n<li><strong>\u66f4\u65b0\u7684\u5eab\u548c\u5de5\u5177\uff1a<\/strong>\u8a31\u591a\u57fa\u65bc Python \u7684\u5de5\u5177\u548c\u5eab\u5df2\u7d93\u66f4\u65b0\u70ba\u652f\u6301 Python 3\uff0c\u9019\u4f7f\u5f97\u958b\u767c\u8005\u80fd\u5920\u5229\u7528\u6700\u65b0\u7684\u529f\u80fd\u548c\u6027\u80fd\u6539\u9032\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%82%ba%e4%bd%95%e8%a6%81%e7%a7%bb%e9%99%a4-python-2%ef%bc%9f-tzvXxKgOtO\">\u70ba\u4f55\u8981\u79fb\u9664 Python 2\uff1f<\/h2>\n<p>\u79fb\u9664 Python 2 \u7684\u4e3b\u8981\u539f\u56e0\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u5b89\u5168\u6027\uff1a<\/strong>\u96a8\u8457 Python 2 \u505c\u6b62\u652f\u6301\uff0c\u4efb\u4f55\u6f5b\u5728\u7684\u5b89\u5168\u6f0f\u6d1e\u5c07\u4e0d\u6703\u88ab\u4fee\u5fa9\uff0c\u9019\u4f7f\u5f97\u4f7f\u7528 Python 2 \u7684\u7cfb\u7d71\u9762\u81e8\u98a8\u96aa\u3002<\/li>\n<li><strong>\u8cc7\u6e90\u96c6\u4e2d\uff1a<\/strong>\u5c07\u8cc7\u6e90\u96c6\u4e2d\u65bc Python 3 \u7684\u958b\u767c\u548c\u6539\u9032\uff0c\u80fd\u5920\u52a0\u901f\u65b0\u529f\u80fd\u7684\u63a8\u51fa\u548c\u6027\u80fd\u7684\u63d0\u5347\u3002<\/li>\n<li><strong>\u793e\u7fa4\u652f\u6301\uff1a<\/strong>\u96a8\u8457\u8d8a\u4f86\u8d8a\u591a\u7684\u958b\u767c\u8005\u8f49\u5411 Python 3\uff0c\u793e\u7fa4\u7684\u652f\u6301\u548c\u8cc7\u6e90\u4e5f\u9010\u6f38\u5411 Python 3 \u50be\u659c\uff0c\u9019\u4f7f\u5f97\u4f7f\u7528 Python 3 \u7684\u958b\u767c\u8005\u80fd\u5920\u7372\u5f97\u66f4\u591a\u7684\u5e6b\u52a9\u548c\u8cc7\u6e90\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e5%9c%a8-ubuntu-20-04-lts-%e4%b8%ad%e4%bd%bf%e7%94%a8-python-3-tzvXxKgOtO\">\u5982\u4f55\u5728 Ubuntu 20.04 LTS \u4e2d\u4f7f\u7528 Python 3<\/h2>\n<p>\u5c0d\u65bc\u5e0c\u671b\u5728 Ubuntu 20.04 LTS \u4e2d\u4f7f\u7528 Python \u7684\u958b\u767c\u8005\u4f86\u8aaa\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u7684\u6b65\u9a5f\uff1a<\/p>\n<pre><code>sudo apt update\nsudo apt install python3\npython3 --version\n<\/code><\/pre>\n<p>\u9019\u4e9b\u547d\u4ee4\u5c07\u66f4\u65b0\u7cfb\u7d71\u7684\u5305\u7ba1\u7406\u5668\uff0c\u5b89\u88dd Python 3\uff0c\u4e26\u6aa2\u67e5\u5b89\u88dd\u7684\u7248\u672c\u3002<\/p>\n<h2 id=\"%e7%b5%90%e8%ab%96-tzvXxKgOtO\">\u7d50\u8ad6<\/h2>\n<p>Ubuntu 20.04 LTS \u7684\u63a8\u51fa\u6a19\u8a8c\u8457\u5c0d Python 2 \u7684\u5fb9\u5e95\u544a\u5225\uff0c\u9019\u4e00\u8b8a\u5316\u4e0d\u50c5\u63d0\u9ad8\u4e86\u7cfb\u7d71\u7684\u5b89\u5168\u6027\uff0c\u9084\u4fc3\u9032\u4e86\u958b\u767c\u8005\u5411\u66f4\u73fe\u4ee3\u5316\u7684 Python 3 \u904e\u6e21\u3002\u96a8\u8457\u958b\u6e90\u793e\u7fa4\u7684\u4e0d\u65b7\u767c\u5c55\uff0c\u9019\u4e00\u8da8\u52e2\u5c07\u6301\u7e8c\u5f71\u97ff\u672a\u4f86\u7684\u8edf\u9ad4\u958b\u767c\u3002<\/p>\n<p>\u5c0d\u65bc\u9700\u8981\u7a69\u5b9a\u548c\u5b89\u5168\u7684\u4f3a\u670d\u5668\u74b0\u5883\u7684\u7528\u6236\uff0c\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u81f3\u95dc\u91cd\u8981\u3002\u7121\u8ad6\u662f\u958b\u767c\u65b0\u61c9\u7528\u9084\u662f\u904b\u884c\u73fe\u6709\u670d\u52d9\uff0c\u9078\u64c7\u652f\u6301\u6700\u65b0\u6280\u8853\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u5c07\u6709\u52a9\u65bc\u78ba\u4fdd\u7cfb\u7d71\u7684\u5b89\u5168\u6027\u548c\u6027\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu 20.04 LTS focuses on phasing out Python 2, ensuring a more secure and efficient environment for developers and users alike.<\/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-51871","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51871","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=51871"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51871\/revisions"}],"predecessor-version":[{"id":51872,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51871\/revisions\/51872"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=51871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=51871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=51871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}