CentOS 7下安装python3

1. 安装python3

 1.下载安装包:

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

 2.安装必要的一些依赖包: 

  yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel zlib-devel

 3.解压,编译,安装

  tar -zxvf Python-3.6.3.tgz  #解压

  cd Python-3.6.3   #进入解压后的目录

  ./configure --prefix=/usr/local/python3  (prefix表示安装的路径,我安装在/usr/local中,也可以安装其他地方)  #编译

  make && make install   #安装

 4.创建python3的软连接

  ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3    (软连接的文件名不要用python,因为python已经指向了python2.7)

 5.创建pip3的软连接

  ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

 

from :https://blog.csdn.net/lianxiaopang/article/details/78492829

posted @ 2018-08-08 10:32  一只小麻瓜  阅读(576)  评论(0编辑  收藏  举报