linux安装python3.6.5

inux下因为默认带python了,如果要升级版本的,要先把系统自带的python改名或者卸载掉,再安装你要的python版本,centos下由于yum依赖自带的python2.6,所有不能卸载。

linux安装python3.6.5

linux安装python3.6.5 

linux安装python3.6.5

linux安装python3.6.5

linux安装python3.6.5

linux安装python3.6.5

linux安装python3.6.5

linux安装python3.6.5

python指向的是python2 ,python2指向的是python2.7,那也就是在控制台输入python、python2、python2.7都是运行python2.7,

如果我们安装python3.6,让python指向3.6, python2指向python2.7就可以了

安装依赖(编译工具及库文件):yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssldevel

创建目录:mkdir -p /usr/local/python3

上传安装包:rz

linux安装python3.6.5

或者直接下载:https://www.python.org/ftp/python/

wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz

解压:tar -zxvf Python-3.6.2.tgz

进入解压后的目录,编译安装

指定安装目录:./configure --prefix=/usr/local/python3

linux安装python3.6.5

make

linux安装python3.6.5

make install

linux安装python3.6.5

也成功安装了pip、setuptools

linux安装python3.6.5

linux安装python3.6.5

改名备份

linux安装python3.6.5

建立python3的软链

ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3

ln -s /usr/local/python3/bin/python3.6 /usr/bin/python

linux安装python3.6.5

可以看到,python和python3都指向了python3.6

linux安装python3.6.5

linux安装python3.6.5

linux安装python3.6.5

验证,pip3找不到

linux安装python3.6.5

方法一:添加环境变量

linux安装python3.6.5

linux安装python3.6.5

linux安装python3.6.5

linux安装python3.6.5

 

相关推荐