ubuntu server 14.04LTS升級Python3.5

依次執行以下命令:須要root權限,普通用戶能夠使用sudo 來執行如下命令python

root@ubuntu-server:~# add-apt-repository ppa:fkrull/deadsnakeslinux

root@ubuntu-server:~# apt-get updatebootstrap

root@ubuntu-server:~# apt-get install python3.5      ubuntu

root@ubuntu-server:~# python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()python2.7

這樣就安裝好了,不過因爲環境變量的影響,所以,默認狀況下,輸入python進入的是python2.7.6,輸入python3進入的是python3.4,只有輸入python3.5才進入到python3.5。所以咱們能夠根據須要作如下更改:orm

root@ubuntu-server:~# ln -s /usr/bin/python3.5 /usr/bin/python35server

root@ubuntu-server:~# python35
Python 3.5.3 (default, Apr 22 2017, 00:00:00)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>ip

root@ubuntu-server:~# mv /usr/bin/python3 /usr/bin/python34get

root@ubuntu-server:~# python34
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> it

安裝pip

root@ubuntu-server:~# wget https://bootstrap.pypa.io/get-pip.py

root@ubuntu-server:~# python35 get-pip.py

root@ubuntu-server:~# pip3 install setuptools –upgrade

root@ubuntu-server:~# pip -V
pip 9.0.1 from /usr/local/lib/python3.5/dist-packages (python 3.5)

新手小白初學Python,若有錯誤之處,歡迎指正。

相關文章
相關標籤/搜索