【软件版本说明】
软件名 | 版本号 |
---|---|
python | 3.5.2 |
1.一键安装Python脚本
#!/bin/bash
#这是一个在[Ubuntu16.04.3]上安装python3.5的脚本
#此脚本将会以python3.5取代Ubuntu默认安装的python2.7
#如果,你要是使用python2.7请输入Python2进行相关操作
#python3.5将会被安装到【/usr/local/python3/Python-3.5.4】目录
#【PS】请以【root】用户运行此脚本
echo "----------开始安装python3.5.4版本-----------"
#Python-3.5.4.tar.xz文件->>需要依赖gcc make进行编译与安装
sudo apt-get update && apt-get install -y gcc make
sudo mkdir /usr/local/python3
#sudo wget http://www.python.org/ftp/python/3.5.4/Python-3.5.4.tar.xz
sudo wget https://coding.net/u/jamesz2011/p/ubuntu_lib1/git/raw/master/python/Python-3.5.4.tar.xz
sudo tar xvf Python-3.5.4.tar.xz -C /usr/local/python3
cd /usr/local/python3/Python-3.5.4
sudo ./configure --prefix=/usr/local/python3/Python-3.5.4
make && make install
sudo /usr/local/python3/Python-3.5.4/bin/python3.5 /usr/local/bin/python3
#sudo update-alternatives --install /usr/local/bin/python3 python /usr/local/python3/Python-3.5.4/bin/python3.5 400
#sudo update-alternatives --config python
sudo chmod a+x ~/.bashrc
#以alias的方式设置python3.5为系统中的默认python版本,alias被写入【~/.bashrc】中
sudo echo "alias python='python3'" >> ~/.bashrc
#安装pip工具,并设置pip的源为阿里源
sudo apt-get update && apt-get install -y python3-pip
#以alias的方式设置python3.5为系统中的默认python版本,alias被写入【~/.bashrc】中
sudo echo "alias pip='pip3'" >> ~/.bashrc
#source ~/.bashrc
#验证当前默认python的版本
#echo "if the versoin of python is v3.5.4----> install ok!!!!"
#python -v
#python3
#pip升级
#pip install --upgrade pip
#设置pip的源为阿里源
echo "sudo pip install --upgrade pip"
echo "sudo pip install turtle --trusted-host mirrors.aliyun.com"
echo "now ,system will restart,please 安装pip阿里源在reboot后"
reboot
2.install_python3.sh文件地址:
3.用法:
wget https://coding.net/u/jamesz2011/p/ubuntu_lib1/git/raw/master/python/install_python3.sh
sudo chmod a+x install_python3.sh
sudo dos2unix install_python3.sh
sudo source install_python3.sh
[注意]系统会**自动重启**,下面代码重启后手动添加
#pip升级
pip install --upgrade pip
#设置pip的源为阿里源
pip install turtle --trusted-host mirrors.aliyun.com