Centos7.3 + Python3.6

安装依赖

# yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc

安装Python3.6.2

# wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz
# tar -xzvf Python-3.6.2.tgz -C /tmp
# cd  /tmp/Python-3.6.2/

把Python3.6安装到 /usr/local 目录

# ./configure --prefix=/usr/local
# make
# make altinstall

更改/usr/bin/python链接

# cd /usr/bin
# mv  python python.backup
# ln -s /usr/local/bin/python3.6 /usr/bin/python
# ln -s /usr/local/bin/python3.6 /usr/bin/python3

更改yum脚本的python依赖

# cd /usr/bin
# ls yum*
yum yum-config-manager yum-debug-restore yum-groups-manager yum-builddep yum-debug-dump yumdownloader
更改以上文件头为:
#!/usr/bin/python 改为 #!/usr/bin/python2

修改gnome-tweak-tool配置文件

# vi /usr/bin/gnome-tweak-tool
#!/usr/bin/python 改为 #!/usr/bin/python2

修改urlgrabber配置文件

# vi /usr/libexec/urlgrabber-ext-down
#!/usr/bin/python 改为 #!/usr/bin/python2

安装pip

查看/usr/local/bin/目录,我们发现安装python3.6时已经同时安装好了pip


这里做个软链方便使用

# ln -s /usr/local/bin/pip3.6 /usr/local/bin/pip3
# ln -s /usr/local/bin/pip3.6 /usr/local/bin/pip

参考http://www.jianshu.com/p/325f16755680

你可能感兴趣的:(Centos7.3 + Python3.6)