{"id":219,"date":"2019-09-16T15:00:01","date_gmt":"2019-09-16T07:00:01","guid":{"rendered":"http:\/\/www.guanhaobo.cn\/?p=219"},"modified":"2019-09-16T15:00:01","modified_gmt":"2019-09-16T07:00:01","slug":"centos%e4%b8%8a%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%aepython3-7","status":"publish","type":"post","link":"https:\/\/www.guanhaobo.cn\/?p=219","title":{"rendered":"CentOS\u4e0a\u5b89\u88c5\u914d\u7f6ePython3.7"},"content":{"rendered":"<h3>\u5f15\u8a00<\/h3>\n<p>\u4e4b\u524d\u4e00\u76f4\u7528Ubuntu\uff0c\u5b89\u88c5\u8f6f\u4ef6\u5f88\u7b80\u5355\uff0c\u7528 apt \u5c31\u884c\u4e86\u3002\u6700\u8fd1\u60f3\u5728\u670d\u52a1\u5668\u4e0a\u5b89\u88c5Python3\uff0c\u4f46\u670d\u52a1\u5668\u7684\u64cd\u4f5c\u7cfb\u7edf\u662fCentOS\uff0c\u5b89\u88c5\u8fc7\u7a0b\u6bd4\u8f83\u9ebb\u70e6\uff0c\u6240\u4ee5mark\u4e0b\u6765\u4e86\u3002<\/p>\n<h3>\u5177\u4f53\u6b65\u9aa4<\/h3>\n<h5>\u4e00\u3001\u5b89\u88c5\u4f9d\u8d56\u5305<\/h5>\n<p><code>yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make<\/code><\/p>\n<h5>\u4e8c\u3001\u518d\u5b89\u88c5\u4e00\u4e2a\u5de5\u5177\uff0c\u5426\u5219\u4f1a\u5bfc\u81f4pip\u5b89\u88c5\u5931\u8d25<\/h5>\n<p><code>yum install libffi-devel -y<\/code><\/p>\n<h5>\u4e09\u3001\u4e0b\u8f7dPython3.7\u7684\u5305<\/h5>\n<p>\u6709\u4e24\u79cd\u65b9\u6cd5\uff0c\u4e00\u79cd\u662f\u4ece\u5b98\u7f51\u4e0b\u8f7d\uff0c\u7136\u540e\u4e0a\u4f20\u5230CentOS\u4e0a\uff1b\u53e6\u4e00\u79cd\u662f\u901a\u8fc7wget\u547d\u4ee4\u76f4\u63a5\u4e0b\u8f7d\u3002<br \/>\n1.\u5b98\u65b9\u4e0b\u8f7d\uff1a<br \/>\n\u6253\u5f00python\u7684\u5b98\u65b9\u7f51\u7ad9\uff0c\u4e0b\u8f7dpython3.7\uff0c\u9009\u62e9Gzipped source tarball\uff0c\u4e0b\u8f7d\u5230\u672c\u5730\uff0c\u7136\u540e\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u5373\u53ef\u3002<br \/>\n2.wget\u547d\u4ee4\uff1a<br \/>\n<code>wget https:\/\/www.python.org\/ftp\/python\/3.7.0\/Python-3.7.0.tgz<\/code><\/p>\n<h5>\u56db\u3001\u5b89\u88c5Python3.7.0<\/h5>\n<pre><code class=\"language-cpp line-numbers\">tar -zxvf Python-3.7.0.tgz\ncd Python-3.7.0\n.\/configure\nmake&amp;&amp;make install\n<\/code><\/pre>\n<h5>\u4e94\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/h5>\n<pre><code class=\"language-cpp line-numbers\">mv \/usr\/bin\/python \/usr\/bin\/python.bak\nln -s \/usr\/local\/bin\/python3 \/usr\/bin\/python\nmv \/usr\/bin\/pip \/usr\/bin\/pip.bak\nln -s \/usr\/local\/bin\/pip3 \/usr\/bin\/pip\n<\/code><\/pre>\n<p>\u8fd9\u65f6\uff0c\u8f93\u5165python\u6216python3\u5373\u53ef\u8fdb\u5165python3\uff0c\u8f93\u5165python2\u53ef\u4ee5\u8fdb\u5165python2\u7684Shell\uff0c\u8f93\u5165pip -V\u53ef\u4ee5\u67e5\u770b\u5f53\u524dpip\u548cpython\u7248\u672c\u3002<\/p>\n<h5>\u516d\u3001\u914d\u7f6eyum<\/h5>\n<p>\u8fd9\u65f6yum\u4e0d\u80fd\u7528\u4e86\uff0c\u56e0\u4e3ayum\u662f\u4f9d\u8d56python2\u7684\uff0c\u800cpython\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u73b0\u5728\u5df2\u7ecf\u662fpython3\u4e86\u3002\u6267\u884c\u4e0b\u5217\u64cd\u4f5c\u5373\u53ef\u3002<br \/>\n<code>vim \/usr\/libexec\/urlgrabber-ext-down<\/code><br \/>\n\u5c06\u7b2c\u4e00\u884c\/usr\/bin\/python\u6539\u6210\/usr\/bin\/python2\u5373\u53ef\u3002<br \/>\n<code>vim \/usr\/bin\/yum<\/code><br \/>\n\u548c\u4e0a\u9762\u4e00\u6837\uff0c\u5c06\u7b2c\u4e00\u884c\/usr\/bin\/python\u6539\u6210\/usr\/bin\/python2\u5373\u53ef\u3002<br \/>\n\u81f3\u6b64\uff0cpython3.7\u5df2\u7ecf\u5b89\u88c5\u914d\u7f6e\u5b8c\u6210\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u8a00 \u4e4b\u524d\u4e00\u76f4\u7528Ubuntu\uff0c\u5b89\u88c5\u8f6f\u4ef6\u5f88\u7b80\u5355\uff0c\u7528 apt \u5c31\u884c\u4e86\u3002\u6700\u8fd1\u60f3\u5728\u670d\u52a1\u5668\u4e0a\u5b89\u88c5Python3\uff0c\u4f46\u670d\u52a1\u5668 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[21,26],"class_list":["post-219","post","type-post","status-publish","format-standard","hentry","category-note","tag-linux","tag-python"],"_links":{"self":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=219"}],"version-history":[{"count":0,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/219\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}