Linux下安装Python3.6

1.安装Python3.6 依赖环境安装

  # 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 gcc

2.下载Python3.6 

  官方网站:

  https://www.python.org/downloads/

 

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

 

3.安装Python3.6

  我个人习惯安装在/usr/local/python3:

   创建目录:

       #mkdir -p/usr/local/python3

    解压你下载好的Python包(我下载的是Python3.6.1.tgz)

1 # tar -zxvf Python-3.6.1.tgz

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

# cd Python-3.6.1
# ./configure --prefix=/usr/local/python3


#make &&  make install

5.建立python3的软链

 

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

 

6.并将/usr/local/python3/bin加入PATH环境变量

# vim ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
export PATH



保存退出

生成更改的环境变量:

# source ~/.bash_profile

检查Python3及pip3是否正常可用:

1 # python3 -V
2 Python 3.6.1
3 # pip3 -V
4 pip 9.0.1 from /usr/local/python3/lib/python3.6/site-packages (python 3.6)

如果有什么错误的地方就在评论去留言! 

 

posted @ 2019-04-24 22:21  QQmini  阅读(192)  评论(0编辑  收藏  举报