{"id":2095,"date":"2017-04-18T23:14:32","date_gmt":"2017-04-18T15:14:32","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=2095"},"modified":"2017-04-18T23:14:32","modified_gmt":"2017-04-18T15:14:32","slug":"centos-7-2%e5%ae%89%e8%a3%85python3-%e7%ae%80%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/jishu\/linux\/centos-7-2%e5%ae%89%e8%a3%85python3-%e7%ae%80%e8%ae%b0\/","title":{"rendered":"CentOS 7.2\u5b89\u88c5Python3 \u7b80\u8bb0"},"content":{"rendered":"<p>\u76ee\u524d\u5b66\u4e60python3\u5df2\u7ecf\u6210\u4e3a\u4e3b\u6d41\uff0c\u5bf9\u4e8ePython3\u7684\u5b89\u88c5\uff0c\u8fd9\u91cc\u505a\u4e00\u4e0b\u7b80\u5355\u7684\u603b\u7ed3\uff0c\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u6709\u6709\u4e00\u4e9b\u5c0f\u5751\uff0c\u5206\u4eab\u51fa\u6765\u4f9b\u5927\u5bb6\u53c2\u8003\u3002<br \/>\n\u672c\u4eba\u4f7f\u7528\u7684\u7cfb\u7edf\u662f\uff1aCentOS 7.2.1511,\u6700\u5c0f\u5316\u7684\u5b89\u88c5\u65b9\u5f0f\uff0c\u5b89\u88c5Python3.5\u7248\u672c\u3002<\/p>\n<p>\u4e0b\u8f7d\u5b89\u88c5Python3<br \/>\n1\u3001 \u5148\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c5\u5fc5\u8981\u7684\u7f16\u8bd1\u73af\u5883\u548c\u5b89\u88c5\u5de5\u5177\uff1a<\/p>\n<p>yum install wget gcc gcc+<\/p>\n<p>2\u3001 \u4e0b\u8f7d\u5b98\u65b9\u7684python3.5.3\u6e90\u7801\u5305<\/p>\n<p>wget\u00a0 https:\/\/www.python.org\/ftp\/python\/3.5.3\/Python-3.5.3.tgz<\/p>\n<p>3\u3001 \u89e3\u538b\u6e90\u7801\u5305\uff0c\u5e76\u5b89\u88c5<\/p>\n<p>tar xvf Python-3.5.3.tgz<br \/>\ncd Python-3.5.3.\/configure<br \/>\nmake<br \/>\nmake install<\/p>\n<p>4\u3001 \u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u6b64\u65f6\u6267\u884cpython3\u7684\u547d\u4ee4\u5c31\u53ef\u4ee5\u67e5\u770b\u5f53\u524d\u7684Python\u7248\u672c<\/p>\n<p>[root@localhost ~]# python3Python 3.5.3 (default, Apr\u00a0 4 2017, 16:32:58)<br \/>\n[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux<br \/>\nType &#8220;help&#8221;, &#8220;copyright&#8221;, &#8220;credits&#8221; or &#8220;license&#8221; for more information.<\/p>\n<p><strong>&gt;&gt;&gt;\u89e3\u51b3Python3\u65e0\u6cd5\u4f7f\u7528\u56de\u9000\u952e<\/strong><br \/>\n\u5728\u5b89\u88c5\u4e86python3\u4e4b\u540e\uff0c\u5982\u679c\u8981\u4f7f\u7528Python3\u7684\u63a7\u5236\u53f0\u754c\u9762\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u662f\u65e0\u6cd5\u4f7f\u7528\u56de\u9000\u952e\u548c\u65b9\u5411\u952e\u79fb\u52a8\u5149\u6807\u7684\u3002\u5728\u4f7f\u7528\u65b9\u5411\u952e\u548c\u56de\u9000\u952e\u63a7\u5236\u5149\u6807\u65f6\uff0c\u56de\u51fa\u73b0\u5982\u4e0b\u60c5\u51b5\uff1a<\/p>\n<p>&gt;&gt;&gt; exit()^H^H^H^H^[[C^[[D<\/p>\n<p>\u5982\u679c\u53ea\u9700\u8981\u4f7f\u7528\u56de\u9000\u952e\uff0c\u53ef\u4ee5\u5148\u6309ctrl\u952e\uff0c\u7136\u540e\u6309\u56de\u9000\u952e\u5220\u9664\uff0c\u4f46\u662f\u8981\u4f7f\u7528\u5de6\u53f3\u7684\u65b9\u5411\u952e\u6765\u79fb\u52a8\u5149\u6807\u7684\u8bdd\u5c31\u4f1a\u51fa\u73b0\u4e71\u7801\u3002\u51fa\u73b0\u8fd9\u4e2a\u95ee\u9898\u7684\u539f\u56e0\u662f\u5728python shell\u4e2d\uff0c\u8fd9\u4e9b\u6309\u952e\u6307\u4ee4\u5e76\u6ca1\u6709\u88ab\u8f6c\u5316\u4e3a\u5177\u4f53\u7684\u64cd\u4f5c\uff0c\u800c\u5b9e\u73b0\u6309\u952e\u529f\u80fd\u6307\u4ee4\u7684\u5c31\u662freadline.<\/p>\n<p>\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u6211\u4eec\u9700\u8981\u5b89\u88c5\u5bf9\u5e94\u7684readline\u5de5\u5177\u3002<\/p>\n<p>yum install readline-devel -y<\/p>\n<p>\u7136\u540e\u6309\u7167\u4e4b\u524d\u7684\u65b9\u5f0f\uff0c\u91cd\u65b0\u7f16\u8bd1\u5b89\u88c5 \u5373\u53ef\uff1a\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u524d\u5b66\u4e60python3\u5df2\u7ecf\u6210\u4e3a\u4e3b\u6d41\uff0c\u5bf9\u4e8ePython3\u7684\u5b89\u88c5\uff0c\u8fd9\u91cc\u505a\u4e00\u4e0b\u7b80\u5355\u7684\u603b\u7ed3\uff0c\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u6709\u6709\u4e00\u4e9b\u5c0f\u5751\uff0c &#8230; <a title=\"CentOS 7.2\u5b89\u88c5Python3 \u7b80\u8bb0\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/jishu\/linux\/centos-7-2%e5%ae%89%e8%a3%85python3-%e7%ae%80%e8%ae%b0\/\" aria-label=\"\u9605\u8bfb CentOS 7.2\u5b89\u88c5Python3 \u7b80\u8bb0\">\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-2095","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\/2095","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=2095"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2095\/revisions"}],"predecessor-version":[{"id":2096,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2095\/revisions\/2096"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=2095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=2095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=2095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}