ubantu安装Python3.6

Ubuntu16.04默认安装了Python2.7和3.5

请注意,系统自带的python千万不能卸载!

  1. 输入命令sudo add-apt-repository ppa:jonathonf/python-3.6
  2. 输入命令sudo apt-get update
  3. 输入命令sudo apt-get install python3.6
  4. 调整Python3的优先级,使得3.6优先级较高

                sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1

                sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2

更改默认值,python默认为Python2,现在修改为Python3

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

此时再输入命令python

可以看到此时已经是Python3.6了

安装pip3.6

curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6

               

你可能感兴趣的:(ubantu安装Python3.6)