原文链接
Ubuntu装置Python的形式与其余Linux零碎有所不同,在这里介绍一下。
配置环境
切换的国内源:
sudo gedit /etc/apt/sources.list
将原有的源正文掉,增加如下内容:
#清华源deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiversedeb 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.8sudo 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 .piptouch pip.conf
用vim编辑pip.conf文件
vim pip.conf
内容如下:
[global]index-url = https://mirrors.aliyun.com/pypi/simple[install]trusted-host=mirrors.aliyun.com
学习更多编程常识,请关注我的公众号:
代码的路