Python 3.x 如何通过shell脚本在centos中自动安装Python3.6.0?

Python 3.x 如何通过shell脚本在centos中自动安装Python3.6.0?,python-3.x,shell,Python 3.x,Shell,我清楚地知道如何在centos中一步一步地安装python3.6。如何通过shell脚本自动安装 通过循序渐进的方法,我使用 tar-xvf python file.tgz /configure--prefix=/path/to/python3 make&&make-install 成功安装python3.6。我想做的是将这些命令写入shell脚本并自动安装 我的脚本如下: #!/bin/bash # creat folder if not exists. That folder if the

我清楚地知道如何在centos中一步一步地安装python3.6。如何通过shell脚本自动安装

通过循序渐进的方法,我使用

tar-xvf python file.tgz

/configure--prefix=/path/to/python3

make&&make-install

成功安装python3.6。我想做的是将这些命令写入shell脚本并自动安装

我的脚本如下:

#!/bin/bash

# creat folder if not exists. That folder if the directory of Python3 programs.
if [ ! -d /usr/python3 ];then
    mkdir /usr/python3
else
    echo "'/usr/python3' exists"
fi

DIR=`pwd`
# extract file from compressed file to tartget directory
tar -xvf Python-3.6.0.tgz -C /usr 
# specify installation location
cd /usr/Python-3.6.0 && ./configure --prefix=/usr/python3 
# make file and install
cd /usr/Python-3.6.0 && make && make install

# creat symlink
ln -s /usr/python3/bin/python3 /usr/bin/python3 
ln -s /usr/python3/bin/pip3 /usr/bin/pip3 
cd ${DIR} 
pip3 install --no-index --find-links=./pkgs -r ./requirements.txt
这个脚本似乎不是逐行运行的,因为
/usr/python3
是空的,我想知道为什么

此外,除了最后一行之外,我在每一行中都添加了
&&&
,这似乎很有效!我真的很困惑