我是靠谱客的博主 单身荔枝,最近开发中收集的这篇文章主要介绍Ubuntu16.04使用sudo add-apt-repository时报错:aptsources.distro.NoDistroTemplateException,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

使用sudo add-apt-repository 时候,系统报错:

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 96, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 114, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 607, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)    
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources
    (self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Kylin/kylin

原因:
我装了ukylin优麒麟系统的软件(ukylin-wine和ukylin-wechat),导致Ubuntu的系统配置lsb-release文件被修改了。而且系统设置中的software&updates都打不开了!
可以看到/etc/lsb-release文件的内容变成了这样:

DISTRIB_ID=Kylin
DISTRIB_RELEASE=V10
DISTRIB_CODENAME=kylin
DISTRIB_DESCRIPTION="Kylin V10 SP1"
DISTRIB_KYLIN_RELEASE=V10
DISTRIB_VERSION_TYPE=enterprise
DISTRIB_VERSION_MODE=normal

解决方法:
修改/etc/lsb-release里面的内容:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.5 LTS"

注: 具体的发型号是16.04的那个版本我忘了,随便写个16.04.5吧。

参考:

  1. Ubuntu安装软件时报错:aptsources.distro.NoDistroTemplateException: Error:Could not find a distribution templ
  2. Ubuntu18.04.5 LTS 安装优麒麟应用商店的坑

最后

以上就是单身荔枝为你收集整理的Ubuntu16.04使用sudo add-apt-repository时报错:aptsources.distro.NoDistroTemplateException的全部内容,希望文章能够帮你解决Ubuntu16.04使用sudo add-apt-repository时报错:aptsources.distro.NoDistroTemplateException所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(61)

评论列表共有 0 条评论

立即
投稿
返回
顶部