天天看点

【linux】虚拟机上的一些问题(ubuntu)

1. apt 获取资源过慢问题

更换apt下载源, apt下载源在 /etc/apt/sources.list中, 先把原来的数据copy一个副本

cd /etc/apt
sudo cp source.list source.list.bak      

然后查看系统的codename, 比如我的是 bionic

yeyeck@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:    18.04
Codename:    bionic
yeyeck@ubuntu:~$       

再把/etc/apt/sources.list里的数据全部删掉, 把以下数据中标记的bionic 全部替换为你系统的codename, 并保存

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

最后执行以下命令

sudo apt-get update      

2. pip3 下载慢的问题

mkdir ~/.pip
sudo vim ~/.pip/pip.conf      

然后在文件中输入以下内容,保存即可

[global]

index-url = http://mirrors.aliyun.com/pypi/simple/

[install]

trusted-host = mirrors.aliyun.com

继续阅读