{"id":195,"date":"2019-11-26T16:40:02","date_gmt":"2019-11-26T08:40:02","guid":{"rendered":"http:\/\/blog.adeying.com\/?p=195"},"modified":"2019-11-26T17:05:10","modified_gmt":"2019-11-26T09:05:10","slug":"centos7-5-%e4%b8%8b%e5%ae%89%e8%a3%85python3-7","status":"publish","type":"post","link":"https:\/\/adeqing.com\/index.php\/2019\/11\/26\/default\/195\/","title":{"rendered":"Centos7.5 \u4e0b\u5b89\u88c5Python3.7"},"content":{"rendered":"<h3 id=\"2\">1.\u9996\u5148\u6765\u770b\u4e00\u4e0b\u7cfb\u7edf\u7248\u672c<\/h3>\n<div class=\"cnblogs_code\">\n<pre data-spm-anchor-id=\"a2c4e.11153940.0.i0.bb5f166abXeHJJ\">[root@python3 ~]# cat \/etc\/redhat-release \r\nCentOS Linux release 7.6.1810 (Core)<\/pre>\n<\/div>\n<h3 id=\"4\">2.\u5b89\u88c5python3.7\u4e4b\u524d\u9700\u8981\u5148\u5b89\u88c5\u4e00\u4e9b\u4f9d\u8d56\uff0c\uff0c\u8fd9\u4e5f\u662f\u4e0a\u9762\u66f4\u65b0yum\u6e90\u7684\u539f\u56e0<\/h3>\n<div class=\"cnblogs_code\">\n<pre data-spm-anchor-id=\"a2c4e.11153940.0.i2.bb5f166abXeHJJ\">[root@python3 ~]# yum -y install zlib-devel bzip2-devel openssl-devel openssl-static ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel lzma gcc\r\n\r\n[root@python3 ~]# yum -y groupinstall \"Development tools\"<\/pre>\n<\/div>\n<p>\u4e0d\u5b89\u88c5\u4e5f\u6709\u53ef\u80fd\u4e0d\u4f1a\u62a5\u9519\uff0c\u4f46\u662f\u5b89\u88c5\u4e86\u4e00\u5b9a\u4e0d\u4f1a\u62a5\u9519\uff0c\u5b89\u4e0d\u5b89\u88c5\u81ea\u5df1\u628a\u63e1\u3002<\/p>\n<h3 id=\"5\">3.\u4e0b\u8f7dpython3.7.5\u5b89\u88c5\u5305\uff0c\u65b9\u6cd5\u5f88\u591a\uff0c\u6211\u8fd9\u91cc\u76f4\u63a5\u7528wget\u4ece\u5b98\u7f51\u4e0a\u4e0b\u8f7d<\/h3>\n<div class=\"cnblogs_code\">\n<pre data-spm-anchor-id=\"a2c4e.11153940.0.i3.bb5f166abXeHJJ\">[root@python3 ~]# cd \/usr\/local\/src\/<span data-spm-anchor-id=\"a2c4e.11153940.0.i4.bb5f166abXeHJJ\">\r\n\r\n[root@python3 src]# wget https:<\/span>\/\/www.python.org\/ftp\/python\/3.7.5\/Python-3.7.5.tar.xz<\/pre>\n<\/div>\n<p>\u5c06\u5b89\u88c5\u5305\u4e0b\u8f7d\u5230\/usr\/local\/src\/\u76ee\u5f55\u4e0b<\/p>\n<h3 id=\"6\">4.\u89e3\u538b&amp;&amp;\u79fb\u52a8<\/h3>\n<div class=\"cnblogs_code\">\n<pre data-spm-anchor-id=\"a2c4e.11153940.0.i5.bb5f166abXeHJJ\">[root@python3 src]# tar xvf Python3.7.5.tar.xz\r\n\r\n[root@python3 src]# mv Python3.7.5 \/usr\/local\/python3.7.5\r\n\r\n[root@python3 src]# cd \/usr\/local\/python3.7.5\/<\/pre>\n<\/div>\n<h3 id=\"7\">5.\u5b89\u88c5&amp;&amp;\u7f16\u8bd1<\/h3>\n<div class=\"cnblogs_code\">\n<pre data-spm-anchor-id=\"a2c4e.11153940.0.i6.bb5f166abXeHJJ\">[root@python3 python-3.7]# .\/configure --prefix=\/usr\/local\/sbin\/python3.7.5<\/pre>\n<\/div>\n<p>\u5c06python3.7\u5b89\u88c5\u5230\/usr\/local\/sbin\/python-3.7\u76ee\u5f55\u4e0b<\/p>\n<div class=\"cnblogs_code\">\n<pre data-spm-anchor-id=\"a2c4e.11153940.0.i8.bb5f166abXeHJJ\">[root@python3 python-3.7]# make &amp;&amp; make install<\/pre>\n<\/div>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u82e5\u51fa\u73b0\u4ee5\u4e0b\u4e24\u884c\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\uff1b<\/p>\n<div class=\"cnblogs_code\">\n<pre>Installing collected packages: setuptools, pip\r\nSuccessfully installed pip-10.0.1 setuptools-39.0.1<\/pre>\n<\/div>\n<h3 id=\"8\">6.\u5b89\u88c5\u6210\u529f\u4e4b\u540e\u5c31\u80fd\u4f7f\u7528\u4e86<\/h3>\n<div class=\"cnblogs_code\">\n<pre>[root@python3 python-3.7]# \/usr\/local\/sbin\/python3.7.5\/bin\/python3\r\nPython 3.7.0 (default, Mar 15 2019, 00:44:37) \r\n[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n&gt;&gt;&gt;\r\n\r\n\u3010\u6b64\u5904\u9000\u51fa\u7684\u547d\u4ee4 exit()\u3011<\/pre>\n<\/div>\n<h3 id=\"9\" data-spm-anchor-id=\"a2c4e.11153940.0.i14.bb5f166abXeHJJ\">7.\u770b\u4e00\u4e0bpython\u547d\u4ee4\u7684\u7edd\u5bf9\u8def\u5f84<\/h3>\n<div class=\"cnblogs_code\">\n<pre>\u279c softSource ll \/usr\/bin\/ |grep python\r\nlrwxrwxrwx 1 root root 9 10\u6708 28 23:12 python2 -&gt; python2.7\r\n-rwxr-xr-x 1 root root 7.1K 8\u6708 7 08:52 python2.7\r\n-rwxr-xr-x 1 root root 1.8K 8\u6708 7 08:51 python2.7-config\r\nlrwxrwxrwx 1 root root 16 10\u6708 28 23:12 python2-config -&gt; python2.7-config\r\nlrwxrwxrwx 1 root root 24 11\u6708 15 15:24 python3.6 -&gt; \/usr\/local\/bin\/python3.6\r\nlrwxrwxrwx 1 root root 40 11\u6708 11 15:38 python3.7 -&gt; \/home\/softSource\/python3.5\/lib\/python3.7\r\nlrwxrwxrwx 1 root root 18 11\u6708 15 14:49 python.backup -&gt; \/usr\/bin\/python2.x\r\nlrwxrwxrwx 1 root root 14 10\u6708 28 23:12 python-config -&gt; python2-config<\/pre>\n<\/div>\n<h3>\u4ee5\u4e0b\u5185\u5bb9\u6839\u636e\u60c5\u51b5\u4f7f\u7528<\/h3>\n<h3 id=\"10\" data-spm-anchor-id=\"a2c4e.11153940.0.i1.bb5f166aTr0HXQ\">8.\u5c06python\u547d\u4ee4\u901a\u8fc7\u8f6f\u94fe\u63a5\u6307\u5411\u5230python3\u547d\u4ee4<\/h3>\n<div class=\"cnblogs_code\">\n<pre>[root@python3 ~]# ll \/usr\/bin\/ |grep python\r\n[root@python3 ~]#ln -s \/usr\/local\/sbin\/python.3.7.5\/bin\/python3 \/usr\/bin\/python3.7.5\r\n<\/pre>\n<\/div>\n<h3 id=\"11\">9.\u67e5\u770b\u73b0\u5728python3.7.5\u7684\u7248\u672c<\/h3>\n<div class=\"cnblogs_code\">\n<pre data-spm-anchor-id=\"a2c4e.11153940.0.i2.bb5f166aTr0HXQ\">[root@python3 ~]# python3.7.5 -V\r\nPython 3.7.5<\/pre>\n<\/div>\n<h3 id=\"12\">10. \uff08\u9009\u62e9\u6027\u8c28\u614e\u4fee\u6539\uff09\u4fee\u6539\u5b8cpython\u9ed8\u8ba4\u7248\u672c\u4e4b\u540e\uff0c\u4f1a\u5b58\u4e0d\u80fd\u6267\u884cyum\u547d\u4ee4\uff0c\u9700\u8981\u505a\u4e00\u4e9b\u4fee\u6539\uff0c\u5982\u4e0b\uff1a<\/h3>\n<div class=\"cnblogs_code\">\n<pre>\u2460\u5c06\/usr\/bin\/yum\u7684\u9876\u90e8\u7684\uff1a\r\n\r\n!\/usr\/bin\/python  \u6539\u6210  !\/usr\/bin\/python2.7 \r\n\r\n\u2461\u5c06\/usr\/libexec\/urlgrabber-ext-down\u7684\u9876\u90e8\u7684\uff1a\r\n\r\n\/usr\/bin\/python  \u6539\u4e3a   \/usr\/bin\/python2.7\r\n\r\n\u2462\u5c06\/usr\/bin\/yum-config-manager\u7684\u9876\u90e8\u7684\r\n\r\n#!\/usr\/bin\/python \u6539\u4e3a #!\/usr\/bin\/python2.7<\/pre>\n<div class=\"cnblogs_code_toolbar\"><\/div>\n<\/div>\n<h3 id=\"13\">11. \uff08\u9009\u62e9\u6027\u8c28\u614e\u4fee\u6539\uff09\u6700\u540e\u5c06pip\u6307\u5411\u5230python3.7<\/h3>\n<div class=\"cnblogs_code\">\n<pre>[root@python3 ~]# ln -s \/usr\/local\/sbin\/python3.7.5\/bin\/pip3 \/usr\/bin\/pip3<\/pre>\n<h3 id=\"11\">9.\u67e5\u770b\u73b0\u5728\u7684pip3\u7248\u672c<\/h3>\n<pre>[root@python3 ~]# pip3 --version\r\npip 19.2.3 from \/usr\/local\/sbin\/python.3.7.5\/lib\/python3.7\/site-packages\/pip (python 3.7)<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1.\u9996\u5148\u6765\u770b\u4e00\u4e0b\u7cfb\u7edf\u7248\u672c [root@python3 ~]# cat \/etc\/redhat-release  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/posts\/195"}],"collection":[{"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/comments?post=195"}],"version-history":[{"count":6,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/posts\/195\/revisions"}],"predecessor-version":[{"id":201,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/posts\/195\/revisions\/201"}],"wp:attachment":[{"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/media?parent=195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/categories?post=195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/tags?post=195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}