Centos7 安装python3.5.3
使用root用户安装:切换到root用户
su
回车,然后输入密码,切换到root用户。
新建一个脚本,如installPython.sh
#!/bin/bash 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 https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgz mkdir /usr/local/python3 tar -zxvf Python-3.5.3.tgz cd Python-3.5.3 ./configure --prefix=/usr/local/python3 make && make install ln -s /usr/local/python3/bin/python3 /usr/bin/python3 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3 pip3 -V python3 -V
改变脚本的权限,为其加上执行权限
例如: chmod u+x installPython.sh
使用root用户执行这个脚本: ./installPython.sh