sudo apt-get install 报错 software-properties-common : Depends: python3:any (>= 3.3.2-2~)

本文主要是介绍sudo apt-get install 报错 software-properties-common : Depends: python3:any (>= 3.3.2-2~),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

  • 1. 问题描述
  • 2. 解决问题
    • 💢2.1 修改镜像源(对我的问题无效)
    • 2.2 自己摸索
    • 2.3 切换系统shell

1. 问题描述

  • 想使用sudo add-apt-repository ppa:openjdk-r/ppa这个命令,但是提示没有add-apt-repository命令,股进行安装
  • add-apt-repository 命令是software-properties-common包的一部分,因此安装这个包就OK了。
  • 但是一度报错。。。
    > sudo apt-get install software-properties-common 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    The following packages have unmet dependencies:software-properties-common : Depends: python3:any (>= 3.3.2-2~)Depends: python3 but it is not going to be installedDepends: python3-gi but it is not going to be installedDepends: python3-dbus but it is not going to be installedDepends: python3-software-properties (= 0.92.37.8) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    

2. 解决问题

💢2.1 修改镜像源(对我的问题无效)

如果要使用清华的源,需要先查看自己系统版本,再去选择合适的镜像源

cat /proc/version
> Linux version 4.4.0-186-generic (buildd@lcy01-amd64-002) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) ) #216-Ubuntu SMP Wed Jul 1 05:34:05 UTC 2020vim /etc/apt/sources.list   
# 在其中加入清华的源 不要删除之前的内容,都保留加上去就可以
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse# 编辑完成,回到shell中
sudo apt-get update 
# 更新一下源 (会去检索刚刚新加的apt-get源)

或者可以使用阿里源,操作都一样,复制上去就行,记得sudo apt-get update一下源。


  • https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
    在这里插入图片描述
  • ✅Ubuntu 16.04配置国内高速apt-get更新源
  • apt-get 详解&&配置阿里源
  • Ubuntu报错software-properties-common : Depends: python3-software-properties

2.2 自己摸索

参考:

  • 无法安装python3的连续报错-mysql include软链接问题
  • Depends:xxx but it is not going to be installed

给了我一些启发,既然有报错信息,缺什么依赖,那就一路安到底,看到底哪里出了问题。

sudo apt-get install software-properties-common
>  software-properties-common : Depends: python3:any (>= 3.3.2-2~)
# 缺这个依赖,那就安装这个依赖sudo apt-get install python3
>  python3 : Depends: python3.4 (>= 3.4.0-0~) but it is not going to be installed# 继续看下一个依赖sudo apt-get install python3.4
> python3.4-minimal : Depends: libpython3.4-minimal (= 3.4.3-1ubuntu1~14.04.7) but it is not going to be installed# 继续看下一个依赖
sudo apt-get install libpython3.4-minimal
> To continue type in the phrase 'Yes, do as I say!'?] `Yes, do as I say! `# 这个字符串需要自己手动敲进去,要长得一模一样
# 不过这个执行的时候报错了
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

另外,参考:ubuntu apt-get安装或卸载软件时出现了python-minimal等错误问题的解决方法

sudo apt-get update --fix-missing
# 修复缺失的包
sudo apt-get autoremove && sudo apt-get clean && sudo apt-get install -f
# 自动清理 修复

执行完上述两条命令之后,再去进行安装,这次出现了和之前不同的信息,

sudo apt-get install software-properties-common

在这里插入图片描述
这种方式是ok的,但是,在检索到所有需要的22个包的信息之后,报了和上面一样的错误。
在这里插入图片描述
解决错误

dpkg: warning: 'find' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

参考:linux误删libc-bin出现dpkg: warning: ‘ldconfig’ not found in PATH or not executable和ubuntu安装octave的小坑
简单来说,就是缺东西了,找不到/sbin目录下的ldconfig了,查看自己文件夹:
在这里插入图片描述

  • 这个文件夹竟然是空的。。。分别查看/usr/local/sbin, /usr/sbin and /sbin这三个文件夹下有没有/sbin/ldconfig/sbin/ldconfig.real文件。
  • 最后在/sbin这个文件夹中看到了/sbin/ldconfig/sbin/ldconfig.real这两个文件。
    在这里插入图片描述
    另外,博客中好像要复原这个配置文件,需要重新安装libc-bin,但是这个包其实是包含在sudo apt-get install build-essential这个里的
sudo apt-get install build-essential
[sudo] password for enadmin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
binutils cpp cpp-4.6 dpkg-dev fakeroot g++ g++-4.6 gcc gcc-4.6
libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
`libc-bin` libc-dev-bin libc6 libc6-dev libdpkg-perl libgomp1 libmpc2 libmpfr4
libquadmath0 libstdc++6-4.6-dev linux-libc-dev manpages-dev

所以应该不是这个问题。

另外,

  • 参考:https://askubuntu.com/questions/399438/how-to-solve-dpkg-error-1-expected-program-not-found-in-path-or-not-executabl
    可能是因为系统路径的问题
    echo $PATH
    > /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
    
  • 参考:‘dpkg-deb’ not found in PATH or not executable
    除了普通用户的PATH,其实还有root用户的PATH呢
    sudo grep -i path /etc/sudoers
    > Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
    
    另外,也可以看看当前这个报错找不到的程序的情况:
    sudo find / -mount -name find -exec ls -ld {} +
    

但是可以看到,其中是包含/sbin这个目录的,那把这个复制过去,复制到/usr/local/sbin这个目录中,也许是真的找不到???

  • 启发之下,可以看到,这个zsh的shell里就没有find这个程序。。。尴尬。
    在这里插入图片描述
  • 其实常规情况下,问题到这里就可以解决了。 我的特殊在于,服务器是公用的,有人把默认的find命令屏蔽了,所以一直找不到。同时zsh这个shell也是被人配置过了,所以一直有问题。
  • 而且这个zsh的shell和bash的shell的切换问题是。可以切换到root用户,root用户默认的shell是bash的shell,使用以下命令
sudo su
# 输入密码之后就进入了root用户权限

参考:

  • 使用sudo命令完成root权限操作

2.3 切换系统shell

参考:

  • linux查看用户默认shell、当前用户shell类型、系统支持shell类型
  • linux、mac的bash和zsh如何切换

查询用户默认shell

cat /etc/passwd

在这里插入图片描述
查看当前用户shell

(base) /sbin > echo $SHELL
/bin/bash

查看当前系统支持的shell的类型

(base) /sbin > cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/tmux
/usr/bin/screen
/bin/zsh
/usr/bin/zsh

所以这里我用的应该就是bash???

(base) /sbin > echo $SHELL    
/bin/bash
(base) /sbin > find       
zsh: command not found: find

但是就很矛盾??明明显示是bash的shell,但是报错却是zsh??

切换zsh为bash试试

chsh -s /bin/bash #切换成bash
chsh -s /bin/zsh # 切换成zsh

这篇关于sudo apt-get install 报错 software-properties-common : Depends: python3:any (>= 3.3.2-2~)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



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

相关文章

解决升级JDK报错:module java.base does not“opens java.lang.reflect“to unnamed module问题

《解决升级JDK报错:modulejava.basedoesnot“opensjava.lang.reflect“tounnamedmodule问题》SpringBoot启动错误源于Jav... 目录问题描述原因分析解决方案总结问题描述启动sprintboot时报以下错误原因分析编程异js常是由Ja

解决Nginx启动报错Job for nginx.service failed because the control process exited with error code问题

《解决Nginx启动报错Jobfornginx.servicefailedbecausethecontrolprocessexitedwitherrorcode问题》Nginx启... 目录一、报错如下二、解决原因三、解决方式总结一、报错如下Job for nginx.service failed bec

Java报错:org.springframework.beans.factory.BeanCreationException的五种解决方法

《Java报错:org.springframework.beans.factory.BeanCreationException的五种解决方法》本文解析Spring框架中BeanCreationExce... 目录引言一、问题描述1.1 报错示例假设我们有一个简单的Java类,代表一个用户信息的实体类:然后,

解决若依微服务框架启动报错的问题

《解决若依微服务框架启动报错的问题》Invalidboundstatement错误通常由MyBatis映射文件未正确加载或Nacos配置未读取导致,需检查XML的namespace与方法ID是否匹配,... 目录ruoyi-system模块报错报错详情nacos文件目录总结ruoyi-systnGLNYpe

解决Failed to get nested archive for entry BOOT-INF/lib/xxx.jar问题

《解决FailedtogetnestedarchiveforentryBOOT-INF/lib/xxx.jar问题》解决BOOT-INF/lib/xxx.jar替换异常需确保路径正确:解... 目录Failed to get nested archive for entry BOOT-INF/lib/xxx

kkFileView启动报错:报错2003端口占用的问题及解决

《kkFileView启动报错:报错2003端口占用的问题及解决》kkFileView启动报错因office组件2003端口未关闭,解决:查杀占用端口的进程,终止Java进程,使用shutdown.s... 目录原因解决总结kkFileViewjavascript启动报错启动office组件失败,请检查of

MySQL CTE (Common Table Expressions)示例全解析

《MySQLCTE(CommonTableExpressions)示例全解析》MySQL8.0引入CTE,支持递归查询,可创建临时命名结果集,提升复杂查询的可读性与维护性,适用于层次结构数据处... 目录基本语法CTE 主要特点非递归 CTE简单 CTE 示例多 CTE 示例递归 CTE基本递归 CTE 结

解决1093 - You can‘t specify target table报错问题及原因分析

《解决1093-Youcan‘tspecifytargettable报错问题及原因分析》MySQL1093错误因UPDATE/DELETE语句的FROM子句直接引用目标表或嵌套子查询导致,... 目录报js错原因分析具体原因解决办法方法一:使用临时表方法二:使用JOIN方法三:使用EXISTS示例总结报错原

Python get()函数用法案例详解

《Pythonget()函数用法案例详解》在Python中,get()是字典(dict)类型的内置方法,用于安全地获取字典中指定键对应的值,它的核心作用是避免因访问不存在的键而引发KeyError错... 目录简介基本语法一、用法二、案例:安全访问未知键三、案例:配置参数默认值简介python是一种高级编

python3如何找到字典的下标index、获取list中指定元素的位置索引

《python3如何找到字典的下标index、获取list中指定元素的位置索引》:本文主要介绍python3如何找到字典的下标index、获取list中指定元素的位置索引问题,具有很好的参考价值,... 目录enumerate()找到字典的下标 index获取list中指定元素的位置索引总结enumerat