【软件版本说明】

软件名 版本号
python 3.5.2

1.一键安装Python脚本

  1. #!/bin/bash
  2. #这是一个在[Ubuntu16.04.3]上安装python3.5的脚本
  3. #此脚本将会以python3.5取代Ubuntu默认安装的python2.7
  4. #如果,你要是使用python2.7请输入Python2进行相关操作
  5. #python3.5将会被安装到【/usr/local/python3/Python-3.5.4】目录
  6. #【PS】请以【root】用户运行此脚本
  7. echo "----------开始安装python3.5.4版本-----------"
  8. #Python-3.5.4.tar.xz文件->>需要依赖gcc make进行编译与安装
  9. sudo apt-get update && apt-get install -y gcc make
  10. sudo mkdir /usr/local/python3
  11. #sudo wget http://www.python.org/ftp/python/3.5.4/Python-3.5.4.tar.xz
  12. sudo wget https://coding.net/u/jamesz2011/p/ubuntu_lib1/git/raw/master/python/Python-3.5.4.tar.xz
  13. sudo tar xvf Python-3.5.4.tar.xz -C /usr/local/python3
  14. cd /usr/local/python3/Python-3.5.4
  15. sudo ./configure --prefix=/usr/local/python3/Python-3.5.4
  16. make && make install
  17. sudo /usr/local/python3/Python-3.5.4/bin/python3.5 /usr/local/bin/python3
  18. #sudo update-alternatives --install /usr/local/bin/python3 python /usr/local/python3/Python-3.5.4/bin/python3.5 400
  19. #sudo update-alternatives --config python
  20. sudo chmod a+x ~/.bashrc
  21. #以alias的方式设置python3.5为系统中的默认python版本,alias被写入【~/.bashrc】中
  22. sudo echo "alias python='python3'" >> ~/.bashrc
  23. #安装pip工具,并设置pip的源为阿里源
  24. sudo apt-get update && apt-get install -y python3-pip
  25. #以alias的方式设置python3.5为系统中的默认python版本,alias被写入【~/.bashrc】中
  26. sudo echo "alias pip='pip3'" >> ~/.bashrc
  27. #source ~/.bashrc
  28. #验证当前默认python的版本
  29. #echo "if the versoin of python is v3.5.4----> install ok!!!!"
  30. #python -v
  31. #python3
  32. #pip升级
  33. #pip install --upgrade pip
  34. #设置pip的源为阿里源
  35. echo "sudo pip install --upgrade pip"
  36. echo "sudo pip install turtle --trusted-host mirrors.aliyun.com"
  37. echo "now ,system will restart,please 安装pip阿里源在reboot后"
  38. reboot

2.install_python3.sh文件地址:

3.用法:

  1. wget https://coding.net/u/jamesz2011/p/ubuntu_lib1/git/raw/master/python/install_python3.sh
  2. sudo chmod a+x install_python3.sh
  3. sudo dos2unix install_python3.sh
  4. sudo source install_python3.sh
  5. [注意]系统会**自动重启**,下面代码重启后手动添加
  6. #pip升级
  7. pip install --upgrade pip
  8. #设置pip的源为阿里源
  9. pip install turtle --trusted-host mirrors.aliyun.com

4.验证: