導航:首頁 > 版本升級 > suse升級python3

suse升級python3

發布時間:2024-06-13 14:28:59

『壹』 linux 上如何安裝並切換最新版本的 Python 3.6

Python 是 Linux 中一種最流行的編程語言。它被寫成了各種工具和庫。除此之外,Python 在開發者之間很流行因為它非常簡單,並且實際很容易掌握。如果你安裝了 Linux 系統,正在學習 Python 並想要使用最新的版本的話,那麼這篇文章就是為你而寫的。現在我已經安裝好了 Linux Mint 18。默認安裝的版本是 2.7 和 3.5。你可以用這個命令檢查:
$ python -V
$ python2 -V
$ python3 -V
安裝最新的 Python 3.6 到 Linux 中:
$ sudo add-apt-repository ppa:jonathonf/python-3.6
$ sudo apt update
$ sudo apt install python3.6
檢查已安裝的 Python 3.6 版本
$ python3.6-V
請注意舊版本仍然還在,它仍然可以通過 python3 可用,新的版本可以通過命令 python3.6。如果你想要默認使用這個版本而不是 3.5 運行所有的程序,這有個工具叫 update-alternatives。但是如果你嘗試獲取可能的列表,我們會得到錯誤:

Python 3.6 - install latest version into Linux Mint
這是正常的,你首先需要為那個問題設置文件,因為維護者沒有設置這個:
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.51
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.62
現在再次查看:
$ update-alternatives --list python3

Python 3.6 - install latest version into Linux Mint
現在我們選擇需要的版本並按需切換。對於設置使用配置命令:
$ sudo update-alternatives --config python3

Python 3.6 - install latest version into Linux Mint
在提示符中,你需要指定默認使用的編號。
選擇版本時要小心,不要去動 python(python2),只使用我說的 python3,Python 2.7 編寫了各種系統工具,如果你嘗試用錯誤的解釋器版本運行它們,可能就不會工作。

『貳』 如何在linux系統中安裝python

1.下載源代碼 http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tar.bz2

2. 安裝

$ tar –jxvf Python-2.5.2.tar.bz2

$ cd Python-2.5.2

$ ./configure

$ make

$ make install

3. 測試

在命令行下輸入python,出現python解釋器即表示已經正確安裝。

在suse10或rhel5(es5)下系統默認已經裝了python但版本是2.4.x;本次安裝後在shell中輸入

#python

會發現顯示結果:

# python

Python 2.4.3 (#1, Dec 11 2006, 11:38:52)

[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2

Type 「help」, 「right」, 「credits」 or 「license」 for more information.

>>>

版本還是2.4.x的

解決辦法:

#cd /usr/bin

#ll |grep python //查看該目錄下python

#rm -rf python

#ln -s PREFIX/Python-2.5.2/python ./python //PREFIX為你解壓python的目錄

#python

# python

Python 2.5.2 (#1, Dec 11 2006, 11:38:52)

[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2

Type 「help」, 「right」, 「credits」 or 「license」 for more information.

>>>

OK!問題解決!

閱讀全文

與suse升級python3相關的資料

熱點內容
qq群文件容量 瀏覽:164
有什麼網站驗證pr 瀏覽:186
如何拍攝飄浮照片教程 瀏覽:366
劍靈白青版本刺客 瀏覽:965
卡車在哪個app可以接單 瀏覽:526
怎麼讀編程文檔java 瀏覽:501
基礎資料庫和半導體哪個好 瀏覽:118
word顯示隱藏標記 瀏覽:63
win10f4麥克風設置 瀏覽:426
昆明碼高少兒編程在哪裡 瀏覽:508
雲資料庫哪個牌子好 瀏覽:479
掃描文件多高解析度 瀏覽:487
蘋果手機js指得是什麼 瀏覽:225
編程適合什麼筆記本 瀏覽:783
c讀文本到資料庫 瀏覽:981
2010word文字背景顏色怎麼去掉 瀏覽:515
網路安全情況核查台賬是什麼 瀏覽:590
linuxwtmp查看 瀏覽:947
app掛號怎麼拿單 瀏覽:902
如何用手機編程出一個心形 瀏覽:934

友情鏈接