最近学校新上线了AI平台,由于其开发环境每次重新启动的时候需要重新配置环境,每次都去查网上的教程太麻烦了,还是自己写个博客记录一下吧~
一、pip安装package报错:Failed to establish a new connection: [Errno -3] Temporary failure in name resolution
解决方法:修改 /etc/resolv.conf 文件,在该文件尾添加如下代码:
nameserver 8.8.8.8
二、解决apt命令无法使用的问题
1.首先,备份系统的源文件sources.list:
cd /etc/apt
sudo cp sources.list sources.list.backup
2.清空源文件:
sudo vim sources.list
ggdG
3.替换文件内容:
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
4.更新apt
sudo apt update
sudo apt upgrade
参考资料:https://www.cnblogs.com/haiton/p/11314102.html
https://www.linuxidc.com/Linux/2019-04/158158.htm