{"id":652,"date":"2023-02-26T13:44:32","date_gmt":"2023-02-26T05:44:32","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=652"},"modified":"2023-04-29T18:44:49","modified_gmt":"2023-04-29T10:44:49","slug":"install-python-under-centos","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/26\/install-python-under-centos\/","title":{"rendered":"CentOS\u4e0b\u5b89\u88c5Python"},"content":{"rendered":"<p>Python: <a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/www.python.org\/downloads\/\">https:\/\/www.python.org\/downloads\/<\/a><\/p>\n<h2>\u5b89\u88c5<\/h2>\n<p><!-- more --><\/p>\n<pre><code># wget https:\/\/www.python.org\/ftp\/python\/3.7.3\/Python-3.7.3.tgz\n\n# yum install gcc make libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel\n# tar -zxf Python-3.7.3.tgz \n# cd Python-3.7.3\/\n# .\/configure --prefix=\/usr\/local\/python37\n# make\n# make install<\/code><\/pre>\n<h2>\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff08python\u548cpip\uff09<\/h2>\n<pre><code># mv \/usr\/bin\/python \/usr\/bin\/python.bak\n# ln -s \/usr\/local\/python37\/bin\/python3 \/usr\/bin\/python\n# mv \/usr\/bin\/pip \/usr\/bin\/pip.bak\n# ln -s \/usr\/local\/python37\/bin\/pip3 \/usr\/bin\/pip<\/code><\/pre>\n<h2>\u9a8c\u8bc1<\/h2>\n<pre><code># python -V\nPython 3.7.3\n# pip -V\npip 19.0.3 from \/usr\/local\/python37\/lib\/python3.7\/site-packages\/pip (python 3.7)<\/code><\/pre>\n<h2>yum\u9519\u8bef\u89e3\u51b3<\/h2>\n<p>\u66f4\u6539\u7cfb\u7edf\u9ed8\u8ba4\u7684python\u547d\u4ee4\u540e\uff0c\u518d\u6b21\u4f7f\u7528<code>yum<\/code>\u547d\u4ee4\u62a5\u9519\uff1a<\/p>\n<pre><code># yum install openssl-devel\n  File &quot;\/bin\/yum&quot;, line 30\n    except KeyboardInterrupt, e:\n                            ^\nSyntaxError: invalid syntax<\/code><\/pre>\n<p>\u8fd9\u662f\u56e0\u4e3a<code>yum<\/code>\u91c7\u7528python\u4f5c\u4e3a\u547d\u4ee4\u89e3\u91ca\u5668\uff0c\u539f\u6765\u7cfb\u7edf\u81ea\u5e26\u7684python\u89e3\u91ca\u5668\u4e3a<code>python2.7<\/code>\uff0c\u800c\u6211\u4eec\u5c06python\u9ed8\u8ba4\u7684\u89e3\u91ca\u5668\u8bbe\u4e3a<code>python3.7<\/code>\uff0c\u5bfc\u81f4\u6309python3.7\u89e3\u67902.7\u7684\u8bed\u6cd5\u51fa\u9519\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<p>\u4fee\u6539<code>\/usr\/bin\/yum<\/code>\u53ca<code>\/usr\/libexec\/urlgrabber-ext-down<\/code>\u6587\u4ef6\u4e2d\u7684\u7b2c\u4e00\u884c\u4e3a<code>#!\/usr\/bin\/python2.7<\/code><\/p>\n<pre><code># vim \/bin\/yum<\/code><\/pre>\n<p>\u4fee\u6539\u5185\u5bb9\uff1a<\/p>\n<pre><code>#!\/usr\/bin\/python2.7<\/code><\/pre>\n<pre><code># vim \/usr\/libexec\/urlgrabber-ext-down<\/code><\/pre>\n<p>\u4fee\u6539\u5185\u5bb9\uff1a<\/p>\n<pre><code>#! \/usr\/bin\/python2.7<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Python: https:\/\/www.python.org\/downloads\/ \u5b89\u88c5 # wget htt [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[144],"class_list":["post-652","post","type-post","status-publish","format-standard","hentry","category-devops-base","tag-python"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=652"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/652\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}