{"id":1095,"date":"2016-08-08T14:19:08","date_gmt":"2016-08-08T06:19:08","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=1095"},"modified":"2016-08-08T14:19:08","modified_gmt":"2016-08-08T06:19:08","slug":"centos-%e4%b8%8b%e5%b0%86-python2-%e5%8d%87%e7%ba%a7%e5%88%b0python3","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/jishu\/linux\/centos-%e4%b8%8b%e5%b0%86-python2-%e5%8d%87%e7%ba%a7%e5%88%b0python3\/","title":{"rendered":"CentOS \u4e0b\u5c06 Python2 \u5347\u7ea7\u5230Python3"},"content":{"rendered":"<p>1. \u4ecePython\u5b98\u7f51\u5230\u83b7\u53d6Python3\u7684\u5305\uff0c \u5207\u6362\u5230\u76ee\u5f55\/usr\/local\/src<\/p>\n<p>#wget \u00a0https:\/\/www.python.org\/ftp\/python\/3.5.1\/Python-3.5.1.tar.x<\/p>\n<p>2. \u4f7f\u7528\u547d\u4ee4\u5982\u4e0b\u547d\u4ee4\u8fdb\u884c\u89e3\u538b\u7f29\uff1a<\/p>\n<p>xz -d Python-3.5.1.tar.xz<br \/>\ntar -xf Python-3.5.1.tar<\/p>\n<p>3. \u5728\/usr\/local\u8def\u5f84\u4e0b\u521b\u5efa\u76ee\u5f55&#8211;python3.5\uff0c \u4e3a\u7b2c4\u6b65\u7684\u5b89\u88c5\u76ee\u5f55<\/p>\n<p>$mkdir \/usr\/local\/python3.5<\/p>\n<p>4. \u7f16\u8bd1\u5b89\u88c5(\u4f1a\u81ea\u52a8\u5b89\u88c5pip-7.1.2)<\/p>\n<p>$cd \/usr\/local\/src\/Python-3.5.1<br \/>\n#.\/configure &#8211;prefix=\/usr\/local\/python3.5<br \/>\n#make all<br \/>\n#make install<br \/>\n#make clean<br \/>\n#make distclean<\/p>\n<p>5. \u8fdb\u5165\u5b89\u88c5\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u68c0\u67e5\u662f\u5426\u5b89\u88c5\u6210\u529f<\/p>\n<p>$ \/usr\/local\/python3.5\/bin\/python3.5 -V<br \/>\nPython 3.5.1<\/p>\n<p>6.\u67e5\u770b\u73af\u5883\u53d8\u91cf\uff0c\u542f\u52a8python\u65f6\u9ed8\u8ba4\u6309\u7167PATH\u7684\u987a\u5e8f\u8fdb\u884c\u67e5\u627e\uff0c\u5728\/usr\/bin\u4e2d\u7684python\u6b64\u65f6\u4e3aPython2.6\u7684\u3002<\/p>\n<p>$echo $PATH<br \/>\n\/usr\/lib\/qt-3.3\/bin:\/usr\/local\/bin:\/usr\/bin:\/bin:\/usr\/local\/sbin:\/usr\/sbin:\/sbin:\/home\/gordon\/bin<\/p>\n<p>7.\u4fee\u6539\u8f6f\u8fde\u63a5\uff0c\u542f\u52a8python\u65f6\u6307\u5411python3.5<\/p>\n<p>\u5907\u4efdpython<br \/>\nmv \/usr\/bin\/python \/usr\/bin\/python2.6.6<\/p>\n<p>2 \u4fee\u6539\u8f6f\u8fde\u63a5<br \/>\nsudo ln -s \/usr\/local\/python3.5\/bin\/python3 \/usr\/bin\/python<\/p>\n<p>8. \u9a8c\u8bc1\u9ed8\u8ba4\u662f\u5426\u542f\u52a8python3.5<\/p>\n<p>$ python -V<br \/>\nPython 3.5.1<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u4ecePython\u5b98\u7f51\u5230\u83b7\u53d6Python3\u7684\u5305\uff0c \u5207\u6362\u5230\u76ee\u5f55\/usr\/local\/src #wget \u00a0ht &#8230; <a title=\"CentOS \u4e0b\u5c06 Python2 \u5347\u7ea7\u5230Python3\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/jishu\/linux\/centos-%e4%b8%8b%e5%b0%86-python2-%e5%8d%87%e7%ba%a7%e5%88%b0python3\/\" aria-label=\"\u9605\u8bfb CentOS \u4e0b\u5c06 Python2 \u5347\u7ea7\u5230Python3\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[49],"tags":[82,380],"class_list":["post-1095","post","type-post","status-publish","format-standard","hentry","category-linux","tag-centos","tag-python"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=1095"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1095\/revisions"}],"predecessor-version":[{"id":1096,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1095\/revisions\/1096"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=1095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=1095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=1095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}