deepin add-apt-repository 诸多问题及其解决

2024-04-20 23:58

本文主要是介绍deepin add-apt-repository 诸多问题及其解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

deepin不会自带这个命令的,需要安装

apt-get install python-software-properties
sudo apt-get install software-properties-common

知乎上的解决方法:
https://www.zhihu.com/question/30361833/answer/84878458

测试命令:

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php

但是使用起来会报错:

Traceback (most recent call last):File "/usr/bin/add-apt-repository", line 160, in <module>sp = SoftwareProperties(options=options)File "/usr/lib/python2.7/dist-packages/softwareproperties/SoftwareProperties.py", line 96, in __init__self.reload_sourceslist()File "/usr/lib/python2.7/dist-packages/softwareproperties/SoftwareProperties.py", line 584, in reload_sourceslistself.distro.get_sources(self.sourceslist)    File "/usr/lib/python2.7/dist-packages/aptsources/distro.py", line 93, in get_sources(self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Deepin/stable

我们看到/usr/share/python-apt/templates/Deepin.info

Suite: unstable
RepositoryType: deb
BaseURI: http://packages.deepin.com/deepin/
MatchURI: \.deepin\.com
MirrorsFile: Deepin.mirrors
Description: Deepin 'unstable'
Component: main
CompDescription: Officially supported
Component: contrib
CompDescription: DFSG-compatible Software with Non-Free Dependencies
Component: non-free
CompDescription: Non-DFSG-compatible Software

(没什么卵用)

修改/etc/lsb-release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=wily
DISTRIB-DESCRIPTION="Ubuntu wily"

最后需要修改一下/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py文件

#  software-properties backend
#
#  Copyright (c) 2004-2007 Canonical Ltd.
#                2004-2005 Michiel Sikkes
#
#  Author: Michiel Sikkes <michiel@eyesopened.nl>
#          Michael Vogt <mvo@debian.org>
#          Sebastian Heinlein <glatzor@ubuntu.com>
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License as
#  published by the Free Software Foundation; either version 2 of the
#  License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
#  USAfrom __future__ import absolute_import, print_functionimport apt_pkg
import copy
from hashlib import md5
import re
import os
import glob
import shutil
import threading
import atexit
import tempfile
try:from string import maketrans
except ImportError:maketrans = str.maketrans
import statfrom tempfile import NamedTemporaryFile
from xml.sax.saxutils import escape
try:from configparser import ConfigParser
except ImportError:from ConfigParser import ConfigParser
from gettext import gettext as _import aptsources
import aptsources.distro
import softwarepropertiesfrom .AptAuth import AptAuth
from aptsources.sourceslist import SourcesList, SourceEntry
from . import shortcuts
from . import ppa
from . import cloudarchive_SHORTCUT_FACTORIES = [ppa.shortcut_handler,cloudarchive.shortcut_handler,shortcuts.shortcut_handler,
]class SoftwareProperties(object):# known (whitelisted) channelsCHANNEL_PATH="/usr/share/app-install/channels/"# release upgrades policyRELEASE_UPGRADES_CONF = "/etc/update-manager/release-upgrades"#RELEASE_UPGRADES_CONF = "/tmp/release-upgrades"(RELEASE_UPGRADES_NORMAL,RELEASE_UPGRADES_LTS,RELEASE_UPGRADES_NEVER) = list(range(3))release_upgrades_policy_map = {RELEASE_UPGRADES_NORMAL : 'normal',RELEASE_UPGRADES_LTS    : 'lts',RELEASE_UPGRADES_NEVER  : 'never',}def __init__(self, datadir=None, options=None, rootdir="/"):""" Provides the core functionality to configure the used software repositories, the corresponding authentication keys and update automation """self.popconfile = rootdir+"/etc/popularity-contest.conf"self.rootdir = rootdirif rootdir != "/":apt_pkg.config.set("Dir", rootdir)# FIXME: some saner way is needed hereif datadir == None:datadir = "/usr/share/software-properties/"self.options = optionsself.datadir = datadirself.sourceslist = SourcesList()self.distro = aptsources.distro.get_distro()self.seen_server = []self.modified_sourceslist = Falseself.reload_sourceslist()self.backup_sourceslist()self.backup_apt_conf()# FIXME: we need to store this value in a config option#self.custom_mirrors = ["http://adasdwww.de/ubuntu"]self.custom_mirrors= []# apt-key stuffself.apt_key = AptAuth(rootdir=rootdir)atexit.register(self.wait_for_threads)def wait_for_threads(self):" wait for all running threads (PPA key fetchers) to exit "for t in threading.enumerate():if t.ident != threading.current_thread().ident:t.join()def backup_apt_conf(self):"""Backup all apt configuration options"""self.apt_conf_backup = {}for option in softwareproperties.CONF_MAP.keys():value = apt_pkg.config.find_i(softwareproperties.CONF_MAP[option])self.apt_conf_backup[option] = valuedef restore_apt_conf(self):"""Restore the stored apt configuration"""for option in self.apt_conf_backup.keys():apt_pkg.config.set(softwareproperties.CONF_MAP[option],str(self.apt_conf_backup[option]))self.write_config()def get_update_automation_level(self):""" Parse the apt cron configuration. Try to fit a predefined use case and return it. Special case: if the user made a custom configurtation, that we cannot represent it will return None """if apt_pkg.config.find_i(softwareproperties.CONF_MAP["autoupdate"]) > 0:# Autodownloadif apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 1\and os.path.exists("/usr/bin/unattended-upgrade"):return softwareproperties.UPDATE_INST_SECelif apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 1 and  \apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0:return softwareproperties.UPDATE_DOWNLOADelif apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0 and \apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 0:return softwareproperties.UPDATE_NOTIFYelse:return Noneelif apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0 and \apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 0:return softwareproperties.UPDATE_MANUALelse:return Nonedef set_update_automation_level(self, state):""" Set the apt periodic configurtation to the selected update automation level. To synchronize the cache update and the actual upgrading function, the upgrade function, e.g. unattended, will run every day, if enabled. """if state == softwareproperties.UPDATE_INST_SEC:apt_pkg.config.set(softwareproperties.CONF_MAP["unattended"], str(1))apt_pkg.config.set(softwareproperties.CONF_MAP["autodownload"], str(1))elif state == softwareproperties.UPDATE_DOWNLOAD:apt_pkg.config.set(softwareproperties.CONF_MAP["autodownload"], str(1))apt_pkg.config.set(softwareproperties.CONF_MAP["unattended"], str(0))elif s

这篇关于deepin add-apt-repository 诸多问题及其解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/921668

相关文章

linux生产者,消费者问题

pthread_cond_wait() :用于阻塞当前线程,等待别的线程使用pthread_cond_signal()或pthread_cond_broadcast来唤醒它。 pthread_cond_wait() 必须与pthread_mutex 配套使用。pthread_cond_wait()函数一进入wait状态就会自动release mutex。当其他线程通过pthread

问题:第一次世界大战的起止时间是 #其他#学习方法#微信

问题:第一次世界大战的起止时间是 A.1913 ~1918 年 B.1913 ~1918 年 C.1914 ~1918 年 D.1914 ~1919 年 参考答案如图所示

2024.6.24 IDEA中文乱码问题(服务器 控制台 TOMcat)实测已解决

1.问题产生原因: 1.文件编码不一致:如果文件的编码方式与IDEA设置的编码方式不一致,就会产生乱码。确保文件和IDEA使用相同的编码,通常是UTF-8。2.IDEA设置问题:检查IDEA的全局编码设置和项目编码设置是否正确。3.终端或控制台编码问题:如果你在终端或控制台看到乱码,可能是终端的编码设置问题。确保终端使用的是支持你的文件的编码方式。 2.解决方案: 1.File -> S

vcpkg安装opencv中的特殊问题记录(无法找到opencv_corexd.dll)

我是按照网上的vcpkg安装opencv方法进行的(比如这篇:从0开始在visual studio上安装opencv(超详细,针对小白)),但是中间出现了一些别人没有遇到的问题,虽然原因没有找到,但是本人给出一些暂时的解决办法: 问题1: 我在安装库命令行使用的是 .\vcpkg.exe install opencv 我的电脑是x64,vcpkg在这条命令后默认下载的也是opencv2:x6

问题-windows-VPN不正确关闭导致网页打不开

为什么会发生这类事情呢? 主要原因是关机之前vpn没有关掉导致的。 至于为什么没关掉vpn会导致网页打不开,我猜测是因为vpn建立的链接没被更改。 正确关掉vpn的时候,会把ip链接断掉,如果你不正确关掉,ip链接没有断掉,此时你vpn又是没启动的,没有域名解析,所以就打不开网站。 你可以在打不开网页的时候,把vpn打开,你会发现网络又可以登录了。 方法一 注意:方法一虽然方便,但是可能会有

vue同页面多路由懒加载-及可能存在问题的解决方式

先上图,再解释 图一是多路由页面,图二是路由文件。从图一可以看出每个router-view对应的name都不一样。从图二可以看出层路由对应的组件加载方式要跟图一中的name相对应,并且图二的路由层在跟图一对应的页面中要加上components层,多一个s结尾,里面的的方法名就是图一路由的name值,里面还可以照样用懒加载的方式。 页面上其他的路由在路由文件中也跟图二是一样的写法。 附送可能存在

vue+elementui分页输入框回车与页面中@keyup.enter事件冲突解决

解决这个问题的思路只要判断事件源是哪个就好。el分页的回车触发事件是在按下时,抬起并不会再触发。而keyup.enter事件是在抬起时触发。 so,找不到分页的回车事件那就拿keyup.enter事件搞事情。只要判断这个抬起事件的$event中的锚点样式判断不等于分页特有的样式就可以了 @keyup.enter="allKeyup($event)" //页面上的//js中allKeyup(e

vue+elementui--$message提示框被dialog遮罩层挡住问题解决

最近碰到一个先执行this.$message提示内容,然后接着弹出dialog带遮罩层弹框。那么问题来了,message提示框会默认被dialog遮罩层挡住,现在就是要解决这个问题。 由于都是弹框,问题肯定是出在z-index比重问题。由于用$message方式是写在js中而不是写在html中所以不是很好直接去改样式。 不过好在message组件中提供了customClass 属性,我们可以利用

Visual Studio中,MSBUild版本问题

假如项目规定了MSBUild版本,那么在安装完Visual Studio后,假如带的MSBUild版本与项目要求的版本不符合要求,那么可以把需要的MSBUild添加到系统中,然后即可使用。步骤如下:            假如项目需要使用V12的MSBUild,而安装的Visual Studio带的MSBUild版本为V14。 ①到MSDN下载V12 MSBUild包,把V12包解压到目录(

YOLO v3 训练速度慢的问题

一天一夜出了两个模型,仅仅迭代了200次   原因:编译之前没有将Makefile 文件里的GPU设置为1,编译的是CPU版本,必须训练慢   解决方案: make clean  vim Makefile make   再次训练 速度快了,5分钟迭代了500次