Ubuntu安裝Python的方式與其他Linux系統(tǒng)有所不同,在這里介紹一下。
配置環(huán)境
切換的國內(nèi)源:
sudo gedit /etc/apt/sources.list
將原有的源注釋掉,添加如下內(nèi)容:
#清華源
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
內(nèi)容如下:
[global]
index-url = https://mirrors.aliyun.com/pypi/simple
[install]
trusted-host=mirrors.aliyun.com
trusted-host=mirrors.aliyun.com
trusted-host=mirrors.aliyun.com
學(xué)習(xí)更多編程知識,請關(guān)注我的公眾號:
審核編輯 黃宇
-
Ubuntu
+關(guān)注
關(guān)注
5文章
592瀏覽量
31254 -
python
+關(guān)注
關(guān)注
56文章
4827瀏覽量
86766
發(fā)布評論請先 登錄
Windows/Ubuntu安裝frida和objection
全志T507-H國產(chǎn)平臺Ubuntu系統(tǒng)正式發(fā)布,讓您的應(yīng)用開發(fā)更便捷!
uclinux上能否編譯安裝python?
如何在Ubuntu中安裝IDLE Python IDE
如何安裝Python解釋器
技巧|ubuntu20安裝

評論