{"id":85,"date":"2019-11-26T02:39:39","date_gmt":"2019-11-26T02:39:39","guid":{"rendered":"http:\/\/www.betterit360.com\/?p=85"},"modified":"2019-11-26T02:39:39","modified_gmt":"2019-11-26T02:39:39","slug":"install-python3-x-on-centos7","status":"publish","type":"post","link":"http:\/\/www.betterit360.com\/?p=85","title":{"rendered":"Install Python3.X on CentOS7"},"content":{"rendered":"\n<p>CentOS7\u9ed8\u8ba4\u81ea\u5e26Python2.7\u7248\u672c\uff0c\u56e0\u4e3a\u9879\u76ee\u9700\u8981\u4f7f\u7528Python3.x\uff0c\u53ef\u4ee5\u6309\u7167\u6b64\u6587\u7684\u65b9\u6cd5\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n\n\n\n<p><strong>1.Requirements<\/strong><\/p>\n\n\n\n<p>yum install gcc openssl-devel bzip2-devel libffi-devel<\/p>\n\n\n\n<p><strong>2.Download Python 3.7<\/strong><\/p>\n\n\n\n<p>cd \/usr\/srcwget<\/p>\n\n\n\n<p><a href=\"https:\/\/www.python.org\/ftp\/python\/3.7.3\/Python-3.7.3.tgz\">https:\/\/www.python.org\/ftp\/python\/3.7.3\/Python-3.7.3.tgz<\/a><\/p>\n\n\n\n<p>tar xzf Python-3.7.3.tgz<\/p>\n\n\n\n<p><strong>3.Install Python 3.7<\/strong><\/p>\n\n\n\n<p>cd Python-3.7.3<\/p>\n\n\n\n<p>.\/configure &#8211;enable-optimizations<\/p>\n\n\n\n<p>make altinstall<\/p>\n\n\n\n<p>Note\uff1amake altinstall is used to prevent replacing the default python binary file \/usr\/bin\/python.<\/p>\n\n\n\n<p><strong>4.Check Python Version<\/strong><\/p>\n\n\n\n<p>python3.7 -V<\/p>\n\n\n\n<p><strong>\u5907\u6ce8\uff1a<\/strong><\/p>\n\n\n\n<p>1.\u5982\u679c\u8981\u4f7f\u7528Python3.x\u4f5c\u4e3apython\u7684\u9ed8\u8ba4\u7248\u672c \uff0c\u53ef\u4ee5\u628a\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u914d\u7f6e\u653e\u5165\/etc\/profile.d\/\u76ee\u5f55\u4e2d\uff0c\u5177\u4f53\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<p>vi \/etc\/profile.d\/python.sh<\/p>\n\n\n\n<p>\u8f93\u5165alias\u53c2\u6570 alias python=\u2019\/usr\/local\/bin\/python3.7\u2019\uff0c\u4fdd\u5b58\u9000\u51fa\u3002<\/p>\n\n\n\n<p>\u4f7f\u914d\u7f6e\u751f\u6548\uff1asource \/etc\/profile.d\/python.sh<\/p>\n\n\n\n<p>2.\u5982\u679c\u975eroot\u7528\u6237\u521b\u5efa\u7684\u6587\u4ef6\u9700\u8981\u6ce8\u610f\u8bbe\u7f6e\u6743\u9650\uff1a<\/p>\n\n\n\n<p>chmod 755 \/etc\/profile.d\/python.sh <\/p>\n","protected":false},"excerpt":{"rendered":"<p>CentOS7\u9ed8\u8ba4\u81ea\u5e26Python2.7\u7248\u672c\uff0c\u56e0\u4e3a\u9879\u76ee\u9700\u8981\u4f7f\u7528Python3.x\uff0c\u53ef\u4ee5\u6309\u7167\u6b64\u6587\u7684\u65b9\u6cd5\u8fdb\u884c\u5b89\u88c5\u3002 &hellip; <a href=\"http:\/\/www.betterit360.com\/?p=85\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cInstall Python3.X on CentOS7\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.betterit360.com\/index.php?rest_route=\/wp\/v2\/posts\/85"}],"collection":[{"href":"http:\/\/www.betterit360.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.betterit360.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.betterit360.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.betterit360.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=85"}],"version-history":[{"count":0,"href":"http:\/\/www.betterit360.com\/index.php?rest_route=\/wp\/v2\/posts\/85\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.betterit360.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.betterit360.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.betterit360.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}