centos 6 python 3をインストールします.6

2967 ワード

システムcentos 6.7,python 2がある.6、python2.7、python3.5
再インストールする予定3.6
主な手順は以下の通り(2017-5-14まとめ):
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
tar -zxvf Python-3.6.1.tgz
cd Python-3.6.1
./configure --enable-shared
make && make altinstall

プロセスは以下の通り(2017-4-13経歴):
[willie@localhost ~]$ su
Password:
[root@localhost willie]# cd /opt
[root@localhost opt]# wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

--2017-04-25 13:59:30--  https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz Resolving www.python.org... 151.101.72.223, 2a04:4e42:11::223 Connecting to www.python.org|151.101.72.223|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 22540566 (21M) [application/octet-stream] Saving to: “Python-3.6.1.tgz” 18% [======>                                ] 4,110,850   8.20K/s   in 11m 48s  2017-04-25 14:11:22 (5.67 KB/s) - Connection closed at byte 4110850. Retrying. --2017-04-25 14:11:23--  (try: 2)  https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz Connecting to www.python.org|151.101.72.223|:443... connected. HTTP request sent, awaiting response... 206 Partial Content Length: 22540566 (21M), 18429716 (18M) remaining [application/octet-stream] Saving to: “Python-3.6.1.tgz” 87% [+++++++==========================>     ] 19,734,058  12.5K/s   in 78m 20s  2017-04-25 15:29:44 (3.25 KB/s) - Connection closed at byte 19734058. Retrying. --2017-04-25 15:29:46--  (try: 3)  https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz Connecting to www.python.org|151.101.72.223|:443... connected. HTTP request sent, awaiting response... 206 Partial Content Length: 22540566 (21M), 2806508 (2.7M) remaining [application/octet-stream] Saving to: “Python-3.6.1.tgz” 100%[++++++++++++++++++++++++++++++++++====>] 22,540,566  37.0K/s   in 82s      2017-04-25 15:31:08 (33.5 KB/s) - “Python-3.6.1.tgz” saved [22540566/22540566]
[root@localhost opt]# tar -zxvf Python-3.6.1.tgz
...
[root@localhost opt]# cd Python-3.6.1
[root@localhost Python-3.6.1]# ./configure --prefix=/opt/Python-361 --enable-shared    #--prefix=          --enable-shared          pyinstaller    
[root@localhost Python-3.6.1]# make && make install
[root@localhost Python-3.6.1]# ln -s /opt/Python-361/bin/python3.6 /usr/bin/python36
[root@localhost Python-3.6.1]# ln -s /opt/Python-361/bin/python3.6 /usr/bin/python361

OK!インストールが完了し、3.6版でスクリプトを実行する必要がある場合はpython 3.6 xxx.pyでいいです.