Ubuntu镜像下更换镜像源和安装pip3及升级和卸载

这里我们需要在Ubuntu服务器镜像中安装pip3进行软件的安装。但是有些服务器中是没有默认安装的,我们需要自己的安装。在这篇文章中老蒋就记录记录如何在ubuntu系统镜像中安装pip3的方法,以及后面如果需要升级和卸载的办法。

Ubuntu镜像下更换镜像源和安装pip3及升级和卸载

对于ubuntu系统镜像升级python的教程老蒋有在"记录在Ubuntu18.04系统安装Python 3.7 或者从 3.6升级"文章中记录的。这里我们还需要解决一个问题,如果我们在使用的国外服务器,老蒋个人建议我们更换成国内的镜像源,比如163或者阿里(Ubuntu18.04更换阿里云镜像源文件解决系统无法升级问题)。

/etc/apt/sources.list

我们需要编辑这个文件替换下面阿里的源。

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

然后我们需要执行:

    apt-get update -y
    apt-get upgrade -y

需要看到没有任何错误。如果有错误需要解决。

apt-get install python3-pip

然后我们再去执行这个命令安装pip3。如果我们需要安装第三方库的话使用:

pip3 install 库名称

进行安装。

pip3 版本也会升级的,如果我们需要升级可以执行命令升级。

pip3 install --upgrade pip

如果我们需要卸载pip3也是可以通过命令:

apt-get remove python3-pip

一般是没有必要卸载的,因为安装库用pip3还是很方便的。

本文出处:老蒋部落 » Ubuntu镜像下更换镜像源和安装pip3及升级和卸载 | 欢迎分享( 公众号:老蒋朋友圈 )

公众号 「老蒋朋友圈」获取站长新知 / 加QQ群 【1012423279】获取商家优惠推送