欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 明星 > 更新清华源

更新清华源

2025/11/4 9:51:42 来源:https://blog.csdn.net/weixin_50563385/article/details/143838900  浏览:    关键词:更新清华源

出现这个问题的原因是网络连接不上 Ubuntu 的镜像服务器,通常是由于网络问题或服务器不可用造成的。以下是一些解决方法:

1. 更换镜像源

由于 cn.archive.ubuntu.com 可能无法访问,建议更换成其他国内可用的镜像源。可以尝试使用阿里云、清华大学等国内的镜像源。

修改源列表步骤
  1. 打开源列表文件:

    sudo nano /etc/apt/sources.list
    
  2. 替换 cn.archive.ubuntu.com 为其他镜像源,例如:

    • 阿里云

      deb http://mirrors.aliyun.com/ubuntu/ lunar main restricted universe multiverse
      deb http://mirrors.aliyun.com/ubuntu/ lunar-updates main restricted universe multiverse
      deb http://mirrors.aliyun.com/ubuntu/ lunar-backports main restricted universe multiverse
      deb http://mirrors.aliyun.com/ubuntu/ lunar-security main restricted universe multiverse
      
    • 清华大学

      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-updates main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-backports main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-security main restricted universe multiverse
      
  3. 保存并退出编辑器。

2. 更新软件包列表

更新源列表后,重新执行以下命令以刷新软件包列表:

sudo apt update

3. 检查网络连接

确保你的网络连接正常,可以通过以下命令测试网络连接是否通畅:

ping -c 4 mirrors.aliyun.com

如果还是无法访问,可以尝试使用 VPN 或联系网络管理员。

4. 清理和重试

如果依旧遇到问题,可以清理已下载的索引文件,并重试更新:

sudo rm -rf /var/lib/apt/lists/*
sudo apt update

尝试以上步骤后,应该可以正常访问镜像源并更新软件包。

这个错误信息表示当前的 Python 环境中缺少 ipykernel 包。你可以通过以下命令来安装或更新它:

/bin/python3 -m pip install ipykernel -U --user --force-reinstall

执行该命令后,Jupyter Notebook 或者其他支持的 Python 内核环境应该可以正常运行。

如果该命令执行过程中遇到网络问题,可以尝试将安装源更换为国内源,例如:

/bin/python3 -m pip install ipykernel -U --user --force-reinstall -i https://pypi.tuna.tsinghua.edu.cn/simple

这会加速安装过程。安装完成后,重新启动 Jupyter 内核再尝试运行代码。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词