标签:conf 链接 adl 3.5 sql 环境 下载 无法 依赖包
python2.7.X 升级至Python36.X
安装Python3
项目是在py3环境下进行编码的,正好Centos默认的py版本是2,我们还需要安装py3才能让程序run起来,在此之前,需要安装开发工具包,因为要编译安装Python
[root@CentOS ~]# yum -y group install "Development Tools"
安装Python的依赖包,不安装依赖可能安装完成后没有pip3 软件。
[root@CentOS ~]# yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel vim
下载目前最新的Python3.5.x
[root@CentOS ~]# wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgz
可能你需要通过yum -y install wget
解压编译安装
[root@CentOS ~]# tar xf Python-3.5.3.tgz
[root@CentOS ~]# cd Python-3.5.3
[root@CentOS Python-3.5.3]# ./configure --prefix=/usr/local/python3.5
[root@CentOS Python-3.5.3]# make
[root@CentOS Python-3.5.3]# make altinstall
为pip3和python3创建链接
[root@CentOS Python-3.5.3]# ln -fs /usr/local/python3.5/bin/python3 /usr/local/bin/
[root@CentOS Python-3.5.3]# ln -fs /usr/local/python3.5/bin/pip3 /usr/local/bin/
[root@CentOS Python-3.5.3]# mv /usr/bin/python/usr/bin/python_old
[root@CentOS Python-3.5.3]# ln -fs /usr/local/python3.5/bin/python3.5 /usr/bin/python
[root@CentOS Python-3.5.3]# ln -fs /usr/local/python3.5/bin/pip3.5 /usr/bin/pip
验证安装
[root@CentOS Python-3.5.3]# pip -V
pip 9.0.1 from /usr/local/python3.5/lib/python3.5/site-packages (python 3.5)
[root@CentOS Python-3.5.3]# python -V
Python 3.5.3
修改yum文件,否则yum将无法下载
vim /usr/bin/yum
将#!/usr/bin/python修改为#!/usr/bin/python2.7保存即可生效
标签:conf 链接 adl 3.5 sql 环境 下载 无法 依赖包
原文地址:http://www.cnblogs.com/youngthink/p/6668127.html