centos7安装python3.6环境
安装python3.6环境准备环境1.下载Python-3.6.2.tar.xz安装包并解压[root@vps8 ~]# cd /home/www/download/[root@vps8 download]# wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz[root@vps8 download...
·
安装python3.6环境
准备环境
1.下载Python-3.6.2.tar.xz
安装包并解压
[root@vps8 ~]# cd /home/www/download/
[root@vps8 download]# wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
[root@vps8 download]# tar -xvf Python-3.6.2.tar.xz
[root@vps8 download]# cd Python-3.6.2
2.安装编译环境
[root@vps8 download]# yum install -y
openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc
安装
[root@vps8 download]# mkdir -p /usr/local/python3
[root@vps8 download]# ./configure --prefix=/usr/local/python3 #指定安装目录
[root@vps8 download]# make && make install
## 移除python2的软连接
[root@vps8 download]# ll /usr/bin/py*
-rwxr-xr-x. 1 root root 78 Aug 3 2017 pydoc
lrwxrwxrwx. 1 root root 7 Mar 10 2018 python -> python2
lrwxrwxrwx. 1 root root 9 Mar 10 2018 python2 -> python2.7
-rwxr-xr-x. 1 root root 7136 Aug 3 2017 python2.7
[root@vps8 bin]# rm -rf python
## 建立python3的软连接
[root@vps8 download]# ln -s /usr/local/python3/bin/python3.6 /usr/bin/python
[root@vps8 download]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
## 测试
[root@vps8 download]# python
Python 3.6.2 (default, Mar 9 2018, 20:59:55)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
引发的问题
File “/usr/bin/yum”, line 30 except KeyboardInterrupt, e:
修改文件/usr/bin/yum、/usr/libexec/urlgrabber-ext-down头中相应python为#!/usr/bin/python2(python2.7的软连接)
更多推荐
已为社区贡献13条内容
所有评论(0)