今天装python,版本装错了。

然后删又删不掉,装pip又装不上,报错是这样的:

想装的时候:

7f2a0f717aa3:~/$ sudo apt-get install python3-pip python3-setuptools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-setuptools is already the newest version (45.2.0-1ubuntu0.1).
python3-setuptools set to manually installed.
python3-pip is already the newest version (20.0.2-5ubuntu1.7).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
python3-pip : Depends: python3-distutils but it is not going to be installed
Recommends: build-essential but it is not going to be installed
Recommends: python3-dev (>= 3.2) but it is not going to be installed
python3-setuptools : Depends: python3-distutils but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

想删掉的时候:

7f2a0f717aa3:~/$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
python3-pip : Depends: python3-distutils but it is not installed
Recommends: build-essential but it is not installed
Recommends: python3-dev (>= 3.2) but it is not installed
python3-setuptools : Depends: python3-distutils but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

想按照提示apt --fix-broken install的时候,一直这样:

7f2a0f717aa3:~/$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
python3-distutils python3-lib2to3
The following NEW packages will be installed:
python3-distutils python3-lib2to3
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
7 not fully installed or removed.
Need to get 218 kB of archives.
After this operation, 2115 kB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

New Bing告诉我可以这样解决,如下:

有一些可能的解决方案是:

  1. 运行apt --fix-broken install命令来修复损坏的依赖关系。
  2. 运行apt-get update和apt-get upgrade命令来更新软件包列表和安装最新版本的软件包。
  3. 运行apt-get install -f命令来尝试自动修复依赖关系问题。
  4. 运行dpkg --configure -a命令来配置所有未配置的软件包。

前面三种对我没用,我试过很多次了还是一直报错,导致其他包也装不上。于是用了第四种,然后继续报错:

7f2a0f717aa3:~/$ sudo dpkg --configure -a
dpkg: error: requested operation requires superuser privilege
shandian@7f2a0f717aa3:~/fuzzware$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of python3-setuptools:
python3-setuptools depends on python3-distutils; however:
Package python3-distutils is not installed. dpkg: error processing package python3-setuptools (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-pip:
python3-pip depends on python3-distutils; however:
Package python3-distutils is not installed.
python3-pip depends on python3-setuptools; however:
Package python3-setuptools is not configured yet. dpkg: error processing package python3-pip (--configure):
dependency problems - leaving unconfigured
Setting up python-pip-whl (20.0.2-5ubuntu1.7) ...
Setting up libpython3-stdlib:amd64 (3.8.2-0ubuntu2) ...
Setting up python3 (3.8.2-0ubuntu2) ...
running python rtupdate hooks for python3.8...
running python post-rtupdate hooks for python3.8...
Setting up python3-wheel (0.34.2-1ubuntu0.1) ...
Setting up python3-pkg-resources (45.2.0-1ubuntu0.1) ...
Errors were encountered while processing:
python3-setuptools
python3-pip

NewBing说:

根据网上的信息,您可能遇到了dpkg处理python3-pip软件包时的错误。
有一些可能的解决方案是:

  1. 运行sudo dpkg --remove --force-remove-reinstreq python3-pip python3-setuptools python3-wheel命令来强制删除有问题的软件包
  2. 运行sudo apt-get install python3-pip python3-setuptools python3-wheel命令来重新安装这些软件包。
  3. 运行sudo apt-get -f install命令来尝试自动修复依赖关系问题。

第一种方式work for me。

7f2a0f717aa3:~/$ sudo dpkg --remove --force-remove-reinstreq python3-pip python3-setuptools python3-wheel
(Reading database ... 19413 files and directories currently installed.)
Removing python3-pip (20.0.2-5ubuntu1.7) ...
Removing python3-setuptools (45.2.0-1ubuntu0.1) ...
Removing python3-wheel (0.34.2-1ubuntu0.1) ...

感谢NewBing。

解决方案来源于:How to fix unmet dependencies after removing python?_Ubuntu问答社区

【BUG】Python3|安装python3-pip依赖缺失,might want to run ‘apt --fix-broken install‘ to correct these. unment的更多相关文章

  1. 解决 同时安装 python3,python2环境时,用pip安装 python3 包

    应用场景 默认mac上已经安装了 python2; 而我又安装了 python3,并使用 python3; 安装了 pip 默认,pip安装的包安装在了 python2上了: 但是我想用 pip把安装 ...

  2. ubuntu中安装python3和pip

    python3: 在ubuntu的包中,python的二代和三代版本的命名:二代:python,三代:python3 安装python3: sudo apt install python3 同理:pi ...

  3. CentOS7安装Python3.5

    2. 安装Python的依赖包 yum -y groupinstall "Development tools" yum -y install openssl-devel sqlit ...

  4. 环境准备—之—linux下安装python3和pip3

    转自 上海悠悠 https://www.cnblogs.com/yoyoketang/p/10195102.html 前言 centos7 自带有 python,但是却是 python2 版本的 py ...

  5. jenkins容器内安装python3

    前言 很多小伙伴可能在考虑 jenkins 拉取了 github 上的代码后,发现还越少 python3 环境,那能怎么办呢? 咨询了一位运维朋友给我的答案是,将 python3 挂载到容器工作目录上 ...

  6. Linux基础:CentOS安装python3.7

    1.下载python3 wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz 2.解压 [root@mycentos ~]# ta ...

  7. linux安装python3+selenium

    安装笔记 当前安装使用centos7 安装python3 1.下载 [admin@ ~] wget https://www.python.org/ftp/python/3.6.0/Python-3.6 ...

  8. ubuntn 安装python3 及 django及pip3

    1.sudo apt-get install python3-pip    安装pip3 2.sudo pip3 install django   通过pip3安装django 3. sudo apt ...

  9. python入门第0篇 Windows下python的安装及pip安装和使用

    知识内容: 1. python2和python3安装 2. pip安装及pip命令使用 注:安装python3就可以了,python2除非项目开发需要否则不用安装,目前学习python就使用pytho ...

  10. python3.5学习笔记:linux6.4 安装python3 pip setuptools

    前言: python3应该是python的趋势所在,当然目前争议也比较大,这篇随笔的主要目的是记录在linux6.4下搭建python3环境的过程 以及碰到的问题和解决过程. 另外,如果本机安装了py ...

随机推荐

  1. HT-018 Div3 能量消耗 题解 [ 绿 ] [ 线性 dp ] [ 前缀和优化 ]

    能量消耗:一个前缀和优化 dp 的大典题,要是数据水一点 \(O(n^3)\) 都能硬草过去. 思路 显然,定义 \(dp[i]\) 为考虑前 \(i\) 个塔,并且将第 \(i\) 个塔开启,将前面 ...

  2. 探秘Transformer系列之(3)---数据处理

    探秘Transformer系列之(3)---数据处理 接下来三篇偏重于工程,内容略少,大家可以当作甜点 _. 0x00 概要 有研究人员认为,大模型的认知框架看起来十分接近卡尔·弗里斯顿(Karl F ...

  3. PERT 图表教程

    (翻译自: PERT Chart Tutorial) PERT 图表 是(程序评估和审查技术)的首字母缩写.PERT 图是一种项目管理工具,用于在项目中安排.组织和协调任务.它基本上是一种分析完成给定 ...

  4. docker - [06] 安装部署Tomcat

    题记部分 一.官方测试镜像 官方文档给出以下命令,一般用来测试,用完即删,下载并运行镜像,退出镜像就会自动删除镜像?亲测不会自动删除 docker run -it --rm tomcat:9.0 使用 ...

  5. Docker 容器的数据卷 以及 数据卷容器

    Docker 容器删除后,在容器中产生的数据还在吗? 答案是 不在 Docker 容器和外部机器可以直接交换文件吗? 在没有数据卷的情况下,答案是 不可以 如下图:外部机器:Windows系统(自己的 ...

  6. Opencv | 图形学 | Mingw64 | 如何正确地用MinGW64编译与配置vscode的Opencv环境

    如何正确地用MinGW64编译与配置vscode的Opencv环境 1.前情提要 最近有关于图形学的授课,教授开始布置的上机打码的代码实现作业了.虽说教授为了让我们省心,直接就整了个环境已经配置好的几 ...

  7. FastAPI 表单参数与文件上传完全指南:从基础到高级实战 🚀

    title: FastAPI 表单参数与文件上传完全指南:从基础到高级实战 date: 2025/3/8 updated: 2025/3/8 author: cmdragon excerpt: 本教程 ...

  8. Vulnhub-Hackme

    一.靶机搭建 选择扫描虚拟机 选择路径即可 二.信息收集 靶机信息 Name: hackme: 1 Date release: 18 Jul 2019 难度:初级,目标是通过web漏洞获得有限的权限访 ...

  9. 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构

    概述 先看下面的图片,我们去旅游选择出行模式有很多种,可以骑自行车.可以坐汽车.可以坐火车.可以坐飞机. 作为一个程序猿,开发需要选择一款开发工具,当然可以进行代码开发的工具有很多,可以选择Idea进 ...

  10. Qt 实现带阴影 无边框的QMessageBox

    Qt 实现带阴影的QMessagebox 在实际项目里面使用到了QMessageBox做一个弹窗,最开始是样式不是需要的样式,就去找了一下QMessageBox的样式表,一般来说可以使用findChi ...