{"id":335,"date":"2018-07-15T23:42:07","date_gmt":"2018-07-15T15:42:07","guid":{"rendered":"http:\/\/blog.lovexu.cc\/?p=335"},"modified":"2020-05-12T22:28:38","modified_gmt":"2020-05-12T14:28:38","slug":"centos%e4%b8%8b%e5%8d%87%e7%ba%a7python%e7%89%88%e6%9c%ac%ef%bc%8c%e8%af%a6%e7%bb%86%e6%ad%a5%e9%aa%a4","status":"publish","type":"post","link":"https:\/\/lox.im\/index.php\/335.html","title":{"rendered":"centOS\u4e0b\u5347\u7ea7python\u7248\u672c\uff0c\u8be6\u7ec6\u6b65\u9aa4"},"content":{"rendered":"<p>\u8f6c\u8f7d\u81ea<a id=\"Header1_HeaderTitle\" class=\"headermaintitle\" href=\"http:\/\/www.cnblogs.com\/leon-zyl\/\" target=\"_blank\"  rel=\"nofollow\" >leon-zyl<\/a>\u3002<\/p>\n<div>\n<div>\n<div>1\u3001\u53ef\u5229\u7528linux\u81ea\u5e26\u4e0b\u8f7d\u5de5\u5177wget\u4e0b\u8f7d\uff0c\u5982\u4e0b\u6240\u793a\uff1a\uff08<img alt=\"\" \/>\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-667\" src=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206153537060-1260626541.png\" width=\"249\" height=\"20\" alt=\"1240839-20180206153537060-1260626541\" title=\"1240839-20180206153537060-1260626541\" \/>&nbsp;<\/p>\n<p>\u7b14\u8005\u5b89\u88c5\u7684\u662f\u6700\u5c0fcentos\u7cfb\u7edf\uff0c\u6240\u4ee5\u4f7f\u7528\u7f16\u8bd1\u547d\u4ee4\u524d\uff0c\u5fc5\u987b\u5b89\u88c5wget\u670d\u52a1\uff0c\u8bfb\u8005\u5982\u679c\u5b89\u88c5\u7684\u662f\u754c\u9762centos\u7cfb\u7edf\uff0c\u6216\u8005\u4f7f\u7528\u8fc7\u7f16\u8bd1\u5de5\u5177\u5219\u53ef\u8df3\u8fc7\u5b89\u88c5wget\uff0c\u76f4\u63a5\u8fdb\u884c\u4e0b\u8fb9\u7684\u7f16\u8bd1\u6b65\u9aa4 \uff09<\/p><\/div>\n<\/div>\n<\/div>\n<div>\n<div>wget\u00a0<a href=\"http:\/\/www.python.org\/ftp\/python\/3.3.0\/Python-3.3.0.tgz\" target=\"_blank\"  rel=\"nofollow\" >http:\/\/www.python.org\/ftp\/python\/3.3.0\/Python-3.3.0.tgz<\/a><\/div>\n<div><img alt=\"\" \/><\/div>\n<\/div>\n<div>\n<div><\/div>\n<\/div>\n<div>\n<div>2\u3001\u4e0b\u8f7d\u5b8c\u6210\u540e\u5230\u4e0b\u8f7d\u76ee\u5f55\u4e0b\uff0c\u89e3\u538b<\/div>\n<\/div>\n<div>\n<div>tar -xzvf Python-3.3.0.tgz<\/div>\n<div><img alt=\"\" \/><\/div>\n<\/div>\n<div>\n<div>\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-668\" src=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154128107-1624183554.png\" width=\"324\" height=\"18\" alt=\"1240839-20180206154128107-1624183554\" title=\"1240839-20180206154128107-1624183554\" srcset=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154128107-1624183554.png 324w, https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154128107-1624183554-300x17.png 300w\" sizes=\"auto, (max-width: 324px) 100vw, 324px\" \/>&nbsp;<\/p>\n<\/div>\n<\/div>\n<div>\n<div>3\u3001\u8fdb\u5165\u89e3\u538b\u7f29\u540e\u7684\u6587\u4ef6\u5939<\/div>\n<\/div>\n<div>\n<div>cd Python-3.3.0<\/div>\n<\/div>\n<div>\n<div>\u00a0<img alt=\"\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-669\" src=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154135810-550114657.png\" width=\"473\" height=\"169\" alt=\"1240839-20180206154135810-550114657\" title=\"1240839-20180206154135810-550114657\" srcset=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154135810-550114657.png 473w, https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154135810-550114657-300x107.png 300w\" sizes=\"auto, (max-width: 473px) 100vw, 473px\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-670\" src=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154147388-1439839372.png\" width=\"270\" height=\"23\" alt=\"1240839-20180206154147388-1439839372\" title=\"1240839-20180206154147388-1439839372\" \/><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div>\u00a0<img alt=\"\" \/><\/div>\n<\/div>\n<div>\n<div>4\u3001\u5728\u7f16\u8bd1\u524d\u5148\u5728\/usr\/local\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939python3\uff08\u4f5c\u4e3apython\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u4ee5\u514d\u8986\u76d6\u8001\u7684\u7248\u672c\uff09<\/div>\n<\/div>\n<div>\n<div>mkdir \/usr\/local\/python3\u00a0\u00a0\uff08\u6b64\u5904\u65b0\u5efa\u6587\u4ef6\u5939\u7528mkdir\uff0c\u5982\u679c\u662f\u65b0\u5efa\u6587\u4ef6\u5219\u7528touch\uff09<\/div>\n<div><img alt=\"\" \/>\u00a0\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-671\" src=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154201779-968570782.png\" width=\"324\" height=\"23\" alt=\"1240839-20180206154201779-968570782\" title=\"1240839-20180206154201779-968570782\" srcset=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154201779-968570782.png 324w, https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154201779-968570782-300x21.png 300w\" sizes=\"auto, (max-width: 324px) 100vw, 324px\" \/>&nbsp;<\/p>\n<\/div>\n<\/div>\n<div>\n<div><\/div>\n<\/div>\n<div>\n<div>5\u3001\u5f00\u59cb\u7f16\u8bd1\u5b89\u88c5\uff08<img alt=\"\" \/>\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-672\" src=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154209279-1045604183.png\" width=\"242\" height=\"21\" alt=\"1240839-20180206154209279-1045604183\" title=\"1240839-20180206154209279-1045604183\" \/>&nbsp;<\/p>\n<p>\u7b14\u8005\u5b89\u88c5\u7684\u662f\u6700\u5c0fcentos\u7cfb\u7edf\uff0c\u6240\u4ee5\u4f7f\u7528\u7f16\u8bd1\u547d\u4ee4\u524d\uff0c\u5fc5\u987b\u5b89\u88c5\u7f16\u8bd1\u5957\u4ef6gcc\uff0c\u8bfb\u8005\u5982\u679c\u5b89\u88c5\u7684\u662f\u754c\u9762centos\u7cfb\u7edf\uff0c\u6216\u8005\u4f7f\u7528\u8fc7\u7f16\u8bd1\u5de5\u5177\u5219\u53ef\u8df3\u8fc7\u5b89\u88c5gcc\uff0c\u76f4\u63a5\u8fdb\u884c\u4e0b\u8fb9\u7684\u7f16\u8bd1\u6b65\u9aa4\uff09<\/p><\/div>\n<\/div>\n<div>\n<div>.\/configure --prefix=\/usr\/local\/python3<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-673\" src=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154220091-366429160.png\" width=\"500\" height=\"21\" alt=\"1240839-20180206154220091-366429160\" title=\"1240839-20180206154220091-366429160\" srcset=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154220091-366429160.png 500w, https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154220091-366429160-300x13.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/>&nbsp;<\/p>\n<\/div>\n<div>\n<div><img alt=\"\" \/><\/div>\n<\/div>\n<\/div>\n<div>\n<div>make<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-674\" src=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154229795-71226141.png\" width=\"195\" height=\"22\" alt=\"1240839-20180206154229795-71226141\" title=\"1240839-20180206154229795-71226141\" \/>&nbsp;<\/p>\n<\/div>\n<div><img alt=\"\" \/><\/div>\n<\/div>\n<div>\n<div>make install<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-675\" src=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154240560-1758659009.png\" width=\"233\" height=\"18\" alt=\"1240839-20180206154240560-1758659009\" title=\"1240839-20180206154240560-1758659009\" \/>&nbsp;<\/p>\n<\/div>\n<div><img alt=\"\" \/><\/div>\n<\/div>\n<div>\n<div><\/div>\n<\/div>\n<div>\n<div>6\u3001\u6b64\u65f6\u6ca1\u6709\u8986\u76d6\u8001\u7248\u672c\uff0c\u518d\u5c06\u539f\u6765\/usr\/bin\/python\u94fe\u63a5\u6539\u4e3a\u522b\u7684\u540d\u5b57\uff08\u7b14\u8005\u4fdd\u7559\u4e86\u4e24\u4e2a\u7248\u672c\u7684\uff0c\u4e00\u4e2apython\uff0c\u4e00\u4e2apython3\uff0c\u6240\u4ee5\u7b2c6\u6b65\u7b14\u8005\u7565\u8fc7\uff0c\u628a\u7b2c7\u6b65\u7684\u94fe\u63a5\u540e\u540d\u5b57\u6539\u4e3apython3\uff0c\u8bfb\u8005\u53ef\u6309\u6b63\u5e38\u6b65\u9aa4\uff0c\u5b9e\u73b0\u7684\u6548\u679c\u76f8\u540c\uff09<\/div>\n<\/div>\n<div>\n<div>mv \/usr\/bin\/python \/usr\/bin\/python_old2<\/div>\n<\/div>\n<div>\n<div><\/div>\n<\/div>\n<div>\n<div>7\u3001\u518d\u5efa\u7acb\u65b0\u7248\u672cpython\u7684\u94fe\u63a5<\/div>\n<\/div>\n<div>\n<div>ln -s \/usr\/local\/python3\/bin\/python3 \u00a0\/usr\/bin\/python<\/div>\n<\/div>\n<div>\n<div><\/div>\n<\/div>\n<div>\n<div>8\u3001\u8fd9\u4e2a\u65f6\u5019\u8f93\u5165<\/div>\n<\/div>\n<div>\n<div>python -V<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-676\" src=\"https:\/\/lox.im\/wp-content\/uploads\/2020\/05\/1240839-20180206154252373-1521438227.png\" width=\"261\" height=\"77\" alt=\"1240839-20180206154252373-1521438227\" title=\"1240839-20180206154252373-1521438227\" \/>&nbsp;<\/p>\n<\/div>\n<\/div>\n<div>\n<div>\u3000<img alt=\"\" \/><\/div>\n<\/div>\n<div>\n<div>10\u3001\u5c31\u4f1a\u663e\u793a\u51fapython\u7684\u65b0\u7248\u672c\u4fe1\u606f<\/div>\n<\/div>\n<div>\n<div>[idolaoxu@localhost home]#\u00a0python -V<\/div>\n<\/div>\n<div>\n<div>Python 3.3.0<\/div>\n<\/div>\n<div>\n<div><\/div>\n<\/div>\n<div>\n<div>PS\uff1a\u5982\u679c\u4e0d\u5efa\u7acb\u65b0\u5b89\u88c5\u8def\u5f84python3\uff0c\u800c\u662f\u76f4\u63a5\u9ed8\u8ba4\u5b89\u88c5\uff0c\u5219\u5b89\u88c5\u540e\u7684\u65b0python\u5e94\u8be5\u4f1a\u8986\u76d6linux\u4e0b\u81ea\u5e26\u7684\u8001\u7248\u672c\uff0c\u4e5f\u6709\u53ef\u80fd\u4e0d\u8986\u76d6\uff0c\u5177\u4f53\u770b\u5b89\u88c5\u8fc7\u7a0b\u4e86\uff0c<\/div>\n<\/div>\n<div>\n<div>\n<div>\u8fd9\u4e2a\u5927\u5bb6\u53ef\u4ee5\u81ea\u5df1\u8bd5\u9a8c\u4e0b\uff0c\u5f53\u7136\u5982\u679c\u8fd8\u60f3\u4fdd\u7559\u539f\u6765\u7684\u7248\u672c\uff0c\u90a3\u4e48\u8fd9\u79cd\u65b9\u6cd5\u6700\u597d\u4e0d\u8fc7\u4e86\u3002<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\u81ealeon-zyl\u3002 1\u3001\u53ef\u5229\u7528linux\u81ea\u5e26\u4e0b\u8f7d\u5de5\u5177wget\u4e0b\u8f7d\uff0c\u5982\u4e0b\u6240\u793a\uff1a\uff08\u00a0&nbsp; \u7b14\u8005\u5b89\u88c5\u7684\u662f\u6700\u5c0fcentos\u7cfb &#8230;<\/p>\n","protected":false},"author":1,"featured_media":336,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[4],"tags":[11],"class_list":["post-335","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-internet","tag-11"],"_links":{"self":[{"href":"https:\/\/lox.im\/index.php\/wp-json\/wp\/v2\/posts\/335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lox.im\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lox.im\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lox.im\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lox.im\/index.php\/wp-json\/wp\/v2\/comments?post=335"}],"version-history":[{"count":0,"href":"https:\/\/lox.im\/index.php\/wp-json\/wp\/v2\/posts\/335\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lox.im\/index.php\/wp-json\/wp\/v2\/media\/336"}],"wp:attachment":[{"href":"https:\/\/lox.im\/index.php\/wp-json\/wp\/v2\/media?parent=335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lox.im\/index.php\/wp-json\/wp\/v2\/categories?post=335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lox.im\/index.php\/wp-json\/wp\/v2\/tags?post=335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}