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

相关文章

qt5cored.dll报错怎么解决? 电脑qt5cored.dll文件丢失修复技巧

《qt5cored.dll报错怎么解决?电脑qt5cored.dll文件丢失修复技巧》在进行软件安装或运行程序时,有时会遇到由于找不到qt5core.dll,无法继续执行代码,这个问题可能是由于该文... 遇到qt5cored.dll文件错误时,可能会导致基于 Qt 开发的应用程序无法正常运行或启动。这种错

MySQL启动报错:InnoDB表空间丢失问题及解决方法

《MySQL启动报错:InnoDB表空间丢失问题及解决方法》在启动MySQL时,遇到了InnoDB:Tablespace5975wasnotfound,该错误表明MySQL在启动过程中无法找到指定的s... 目录mysql 启动报错:InnoDB 表空间丢失问题及解决方法错误分析解决方案1. 启用 inno

python3 pip终端出现错误解决的方法详解

《python3pip终端出现错误解决的方法详解》这篇文章主要为大家详细介绍了python3pip如果在终端出现错误该如何解决,文中的示例方法讲解详细,感兴趣的小伙伴可以跟随小编一起了解一下... 目录前言一、查看是否已安装pip二、查看是否添加至环境变量1.查看环境变量是http://www.cppcns

解决Java异常报错:java.nio.channels.UnresolvedAddressException问题

《解决Java异常报错:java.nio.channels.UnresolvedAddressException问题》:本文主要介绍解决Java异常报错:java.nio.channels.Unr... 目录异常含义可能出现的场景1. 错误的 IP 地址格式2. DNS 解析失败3. 未初始化的地址对象解决

Python报错ModuleNotFoundError的10种解决方案

《Python报错ModuleNotFoundError的10种解决方案》在Python开发中,ModuleNotFoundError是最常见的运行时错误之一,通常由模块路径配置错误、依赖缺失或命名冲... 目录一、常见错误场景与原因分析二、10种解决方案与代码示例1. 检查并安装缺失模块2. 动态添加模块

idea报错java: 非法字符: ‘\ufeff‘的解决步骤以及说明

《idea报错java:非法字符:‘ufeff‘的解决步骤以及说明》:本文主要介绍idea报错java:非法字符:ufeff的解决步骤以及说明,文章详细解释了为什么在Java中会出现uf... 目录BOM是什么?1. BOM的作用2. 为什么会出现 \ufeff 错误?3. 如何解决 \ufeff 问题?最

解决Maven项目报错:failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0的问题

《解决Maven项目报错:failedtoexecutegoalorg.apache.maven.plugins:maven-compiler-plugin:3.13.0的问题》这篇文章主要介... 目录Maven项目报错:failed to execute goal org.apache.maven.pl

电脑找不到mfc90u.dll文件怎么办? 系统报错mfc90u.dll丢失修复的5种方案

《电脑找不到mfc90u.dll文件怎么办?系统报错mfc90u.dll丢失修复的5种方案》在我们日常使用电脑的过程中,可能会遇到一些软件或系统错误,其中之一就是mfc90u.dll丢失,那么,mf... 在大部分情况下出现我们运行或安装软件,游戏出现提示丢失某些DLL文件或OCX文件的原因可能是原始安装包

电脑显示mfc100u.dll丢失怎么办?系统报错mfc90u.dll丢失5种修复方案

《电脑显示mfc100u.dll丢失怎么办?系统报错mfc90u.dll丢失5种修复方案》最近有不少兄弟反映,电脑突然弹出“mfc100u.dll已加载,但找不到入口点”的错误提示,导致一些程序无法正... 在计算机使用过程中,我们经常会遇到一些错误提示,其中最常见的就是“找不到指定的模块”或“缺少某个DL

解决IDEA报错:编码GBK的不可映射字符问题

《解决IDEA报错:编码GBK的不可映射字符问题》:本文主要介绍解决IDEA报错:编码GBK的不可映射字符问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录IDEA报错:编码GBK的不可映射字符终端软件问题描述原因分析解决方案方法1:将命令改为方法2:右下jav