教你實現(xiàn)Ubuntu安裝Python
配置環(huán)境
Ubuntu安裝Python的方式與其他Linux系統(tǒng)有所不同,在這里介紹一下。
切換的國內源:
sudo gedit /etc/apt/sources.list
將原有的源注釋掉,添加如下內容:
#清華源 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
更新apt-get:
sudo apt-get update
安裝build-essential:
sudo apt-get install build-essential
安裝Python
安裝Python3.8:
sudo apt-get install python3.8 sudo apt install python3-pip
查看是否成功:
查看Python是否安裝成功:
python3 --version
輸出版本號Python 3.8.5即表示安裝成功。
Ubuntu更換源
臨時更換
使用阿里源:
pip install *** -i https://mirrors.aliyun.com/pypi/simple/
永久更換
新建.pip隱藏文件夾:
cd ~ mkdir .pip
新建pip.conf文件:
cd .pip touch pip.conf
用vim編輯pip.conf文件
vim pip.conf
內容如下:
[global] index-url = https://mirrors.aliyun.com/pypi/simple [install] trusted-host=mirrors.aliyun.com
以上就是教你實現(xiàn)Ubuntu安裝Python的詳細內容,更多關于Ubuntu安裝Python的資料請關注腳本之家其它相關文章!
相關文章
Python 檢查數(shù)組元素是否存在類似PHP isset()方法
isset方法來檢查數(shù)組元素是否存在,在Python中無對應函數(shù),在Python中一般可以通過異常來處理數(shù)組元素不存在的情況,而無須事先檢查2014-10-10
pytorch動態(tài)神經網絡(擬合)實現(xiàn)
這篇文章主要介紹了pytorch動態(tài)神經網絡(擬合)實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2021-03-03
解決CentOS下ImportError: No module named &a
這篇文章主要介紹了解決CentOS下ImportError: No module named '_sqlite3'的問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-12-12
Python使用win32com模塊實現(xiàn)數(shù)據(jù)庫表結構自動生成word表格的方法
這篇文章主要介紹了Python使用win32com模塊實現(xiàn)數(shù)據(jù)庫表結構自動生成word表格的方法,結合實例形式分析了win32com模塊下載、連接mysql、查詢獲取表結構以及使用win32com生成word表格的相關操作技巧,需要的朋友可以參考下2018-07-07

