Python 3.6.3安装

上一篇 / 下一篇  2018-04-04 18:04:13 / 个人分类:python

系统环境:CentOS 7.3
前言:CentOS 7环境下已经自带了python2.7环境,但是如果需要使用最新的Python3则需要自行编译安装,以下为安装过程。 
1、先解决依赖

# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel wget
  • 1

2、wget Python3.6.3;创建程序目录;编译安装

# wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz# mkdir -p /usr/local/python3# tar -zxvf Python-3.6.3.tgz# cd Python-3.6.3/# ./configure --prefix=/usr/local/python3 && make && make install
  • 1
  • 2
  • 3
  • 4
  • 5

如无意外,则会安装完成,如有意外,请自行度娘解决!!! 
3、建立Python3的软链接,并将/usr/local/python3/bin加入bash_profile

# ln -s /usr/local/python3/bin/python3 /usr/bin/python3# vim ~/.bash_profile
  • 1
  • 2
# .bash_profile# Get the aliases and functionsif[-f~/.bashrc ];then. ~/.bashrcfi# User specific environment and startup programs##下面这句为添加内容PATH=$PATH:$HOME/bin:/usr/local/python3/bin

PATH=$PATH:$HOME/binexportPATH
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

然后

# source ~/.bash_profile
  • 1

查看Python3.6.3 pip3是否正常

# python3 -VPython3.6.3# pip3 -Vpip9.0.1from /usr/local/python3/lib/python3.6/site-packages (python3.6)
  • 1
  • 2
  • 3
  • 4

至此,Python3.6.3安装完毕。


TAG:

 

评分:0

我来说两句

Open Toolbar