Centos7下安装多python版本并存开发环境
系统环境:CentOS 7.2 x86_64,该系统自带了python2.7版本。但是项目中用的是python3.5版本,为了保证Centos系统的正常运行,需要安装python3.5与python2.7共存的开发环境。
(1)# wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tar.xz
(2)# tar xf Python-3.5.3.tar.xz -C /usr/local/src/ (yum -y install xz #若失败,重建yum缓存.yum clean all ,yum makecache)
(3)# cd /usr/local/src/Python-3.5.3
(4)#./configure --prefix=/usr/local/python3
(5)#make && make install//从 Python 3.4 开始就已经自带了 pip 和 easy_install(setuptools 包带的命令) 包管理命令,你可以在 /usr/local/python3/bin/ 目录下看到,查看一下已经安装的扩展包:
(6)#/usr/local/python3/bin/pip3 listpip (8.1.1)setuptools (20.10.1)
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command. // 更新pip
(7)#/usr/local/python3/bin/pip3 install --upgrade pip
(8)# /usr/local/python3/bin/pip3 listpip (8.1.2)
setuptools (20.10.1)//查看是否安装成功
(9)执行ln -s /usr/local/python3/bin/python3 /usr/bin/python3命令创建软连接。
执行python -V查看Python是否安装成功。# python -VPython 3.5.3//安装完成。