1.上传下载好的安装包到liunx服务器上

liunx安装python3.6.1_上传下载


2.解压

tar -xvf Python-3.6.1.tgz

3.安装依赖,出现截图中的Comlete时说明安装成功。

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

 

liunx安装python3.6.1_python_02

4.进入python解压路径下,执行以下命令,出现Sucessfully时候说明安装成功。

cd python3.6.1/
 ./configure --prefix=/usr/local/mySpace/python3  #将python3.6.1安装到那个路径下
make && make install

liunx安装python3.6.1_软连接_03

5.建立软连接

ln -s /usr/local/mySpace/python3/bin/python3 /usr/bin/python
ln -s /usr/local/mySpace/python3/bin/pip3 /usr/bin/pip

第一个路径是python的本地路径  第二个是软连接的路径

6.配置环境变量

vim /etc/profile
#配置python
PYTHON_HOME=/usr/local/mySpace/python3
export $PATH:PYTHON_HOME/bin 
export PYTHON_HOME
source /etc/profile

7.验证

liunx安装python3.6.1_python_04