sudo apt-get remove --purge mysql-server mysql-client mysql-common
我尝试使用上面的命令删除mysql时收到以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'mysql-client' is not installed, so not removed
The following package was automatically installed and is no longer required:
php5-mysqlnd
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
mysql-server-core-5.5 php5-mysqlnd python-aptdaemon
python-aptdaemon.gtk3widgets python3-aptdaemon python3-aptdaemon.gtk3widgets
python3-aptdaemon.pkcompat python3-uno python3-update-manager
ubuntu-drivers-common update-manager
The following packages will be REMOVED:
libdbd-mysql-perl* libmysqlclient18* mysql-client-5.5* mysql-common*
mysql-server* mysql-server-5.5* php5-mysql* phpmyadmin*
The following NEW packages will be installed:
php5-mysqlnd
The following packages will be upgraded:
mysql-server-core-5.5 python-aptdaemon python-aptdaemon.gtk3widgets
python3-aptdaemon python3-aptdaemon.gtk3widgets python3-aptdaemon.pkcompat
python3-uno python3-update-manager ubuntu-drivers-common update-manager
10 upgraded, 1 newly installed, 8 to remove and 115 not upgraded.
170 not fully installed or removed.
Need to get 0 B/4,388 kB of archives.
After this operation, 89.9 MB disk space will be freed.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
(Reading database ... 354910 files and directories currently installed.)
Preparing to unpack .../ubuntu-drivers-common_1%3a0.2.91.9_amd64.deb ...
/var/lib/dpkg/info/ubuntu-drivers-common.prerm: 12: /var/lib/dpkg/info/ubuntu-drivers-common.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 12: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/ubuntu-drivers-common_1%3a0.2.91.9_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/ubuntu-drivers-common.postinst: 6:
/var/lib/dpkg/info/ubuntu-drivers-common.postinst: py3compile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../python3-update-manager_1%3a0.196.13_all.deb ...
/var/lib/dpkg/info/python3-update-manager.prerm: 6:
/var/lib/dpkg/info/python3-update-manager.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/python3-update-manager_1%3a0.196.13_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/python3-update-manager.postinst: 6:
/var/lib/dpkg/info/python3-update-manager.postinst: py3compile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../python3-aptdaemon.pkcompat_1.1.1-1ubuntu5.2_all.deb ...
/var/lib/dpkg/info/python3-aptdaemon.pkcompat.prerm: 6:
/var/lib/dpkg/info/python3-aptdaemon.pkcompat.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/python3-aptdaemon.pkcompat_1.1.1-1ubuntu5.2_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/python3-aptdaemon.pkcompat.postinst: 6:
/var/lib/dpkg/info/python3-aptdaemon.pkcompat.postinst: py3compile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../python3-aptdaemon.gtk3widgets_1.1.1-1ubuntu5.2_all.deb ...
/var/lib/dpkg/info/python3-aptdaemon.gtk3widgets.prerm: 6:
/var/lib/dpkg/info/python3-aptdaemon.gtk3widgets.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/python3-aptdaemon.gtk3widgets_1.1.1-1ubuntu5.2_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
No apport report written because MaxReports is reached already
/var/lib/dpkg/info/python3-aptdaemon.gtk3widgets.postinst: 6:
/var/lib/dpkg/info/python3-aptdaemon.gtk3widgets.postinst: py3compile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../python3-aptdaemon_1.1.1-1ubuntu5.2_all.deb ...
/var/lib/dpkg/info/python3-aptdaemon.prerm: 6: /var/lib/dpkg/info/python3-aptdaemon.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/python3-aptdaemon_1.1.1-1ubuntu5.2_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
No apport report written because MaxReports is reached already
/var/lib/dpkg/info/python3-aptdaemon.postinst: 6:
/var/lib/dpkg/info/python3-aptdaemon.postinst: py3compile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../update-manager_1%3a0.196.13_all.deb ...
/var/lib/dpkg/info/update-manager.prerm: 6: /var/lib/dpkg/info/update-manager.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/update-manager_1%3a0.196.13_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
No apport report written because MaxReports is reached already
/var/lib/dpkg/info/update-manager.postinst: 6: /var/lib/dpkg/info/update-manager.postinst: py3compile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../python-aptdaemon.gtk3widgets_1.1.1-1ubuntu5.2_all.deb ...
/var/lib/dpkg/info/python-aptdaemon.gtk3widgets.prerm: 6:
/var/lib/dpkg/info/python-aptdaemon.gtk3widgets.prerm: pyclean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: pyclean: not found
dpkg: error processing archive /var/cache/apt/archives/python-aptdaemon.gtk3widgets_1.1.1-1ubuntu5.2_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
No apport report written because MaxReports is reached already
/var/lib/dpkg/info/python-aptdaemon.gtk3widgets.postinst: 6:
/var/lib/dpkg/info/python-aptdaemon.gtk3widgets.postinst: pycompile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../python-aptdaemon_1.1.1-1ubuntu5.2_all.deb ...
/var/lib/dpkg/info/python-aptdaemon.prerm: 6: /var/lib/dpkg/info/python-aptdaemon.prerm: pyclean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: pyclean: not found
dpkg: error processing archive /var/cache/apt/archives/python-aptdaemon_1.1.1-1ubuntu5.2_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
No apport report written because MaxReports is reached already
/var/lib/dpkg/info/python-aptdaemon.postinst: 6:
/var/lib/dpkg/info/python-aptdaemon.postinst: pycompile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../python3-uno_1%3a4.2.8-0ubuntu2_amd64.deb ...
/var/lib/dpkg/info/python3-uno.prerm: 6: /var/lib/dpkg/info/python3-uno.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/python3-uno_1%3a4.2.8-0ubuntu2_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
No apport report written because MaxReports is reached already
/var/lib/dpkg/info/python3-uno.postinst: 6: /var/lib/dpkg/info/python3-uno.postinst: py3compile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
/var/cache/apt/archives/ubuntu-drivers-common_1%3a0.2.91.9_amd64.deb
/var/cache/apt/archives/python3-update-manager_1%3a0.196.13_all.deb
/var/cache/apt/archives/python3-aptdaemon.pkcompat_1.1.1-1ubuntu5.2_all.deb
/var/cache/apt/archives/python3-aptdaemon.gtk3widgets_1.1.1-1ubuntu5.2_all.deb
/var/cache/apt/archives/python3-aptdaemon_1.1.1-1ubuntu5.2_all.deb
/var/cache/apt/archives/update-manager_1%3a0.196.13_all.deb
/var/cache/apt/archives/python-aptdaemon.gtk3widgets_1.1.1-1ubuntu5.2_all.deb
/var/cache/apt/archives/python-aptdaemon_1.1.1-1ubuntu5.2_all.deb
/var/cache/apt/archives/python3-uno_1%3a4.2.8-0ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
如何解决此问题?
答案 0 :(得分:8)
py3compile:未找到
py3compile
命令是python3-minimal
包的一部分,似乎已被破坏。
要解决此问题,请尝试以下操作:
通过以下方式纠正依赖于破坏的系统:
sudo apt-get -f install
通过以下方式重新配置所有未打包但未配置的软件包:
sudo dpkg --configure -a
如果上述方法无效,请尝试重新安装python3-minimal
包:
sudo apt install -f --reinstall python3-minimal
或者运行:
apt-get download python3-minimal
sudo dpkg -i *python3*.deb
sudo apt install -f
或者下载.pkg
file from kernel.org并通过以下方式从文件安装:
sudo dpkg -i python3-minimal_*.deb
然后确保py3compile
和py3clean
命令可以运行,并且可以从PATH
变量中访问。
答案 1 :(得分:4)
是的,是的。 Debian软件包管理的古老“ Catch-22”情况。当软件包同时提供py3compile
时,它归结为libpython3.x
软件包的一部分,取决于py3compile
的Debian。在那里不行。
我也为此无法工作而感到痛苦,因为我也删除了整个/ usr / [/ local] / lib / python3 *目录。
完成后,Debian软件包管理工具中的任何内容都无法帮助您回到正常的Python3环境。你必须做肉丸手术。
在Debian中重建Python3需要完成三件事:
py3compile
脚本(对于大多数人来说,您已经拥有了此脚本)一个人可以从另一个工作的Debian主机/系统中重新复制/ usr [/ local] / lib目录。但是这次,我将详细介绍有问题的主机中的步骤(好像您没有其他正在运行的主机一样)。
下载受影响的Debian软件包:
py3compile
清理旧东西
cd /tmp
apt-get download libpython3.7-minimal
apt-get download python3.7-minimal
apt-get download python3-minimal # (this is important)
apt-get download libpython3.7-stdlib
apt-get download python3.7
让我们提取丢失的rm -rf /usr[/local]/lib/python3.7*
rm -rf /usr[/local]/bin/python3.7*
update-alternatives --remove python3 /usr[/local]/bin/python3.7
hash -r # removes cached python3 binary path
py3compile
通过根文件系统手动安装
cd /tmp
dpkg-deb -x python3-minimal_3.7.3-1_amd64.deb missing
dpkg-deb -x python3.7-minimal_3.7.3-2_amd64.deb missing
dpkg-deb -x libpython3.7-minimal_3.7.3-2_amd64.deb missing
dpkg-deb -x libpython3.7-stdlib_3.7.3-2_amd64.deb missing
dpkg-deb -x python3.7_3.7.3-2_amd64.deb missing
启动Python3
cd /tmp/missing
sudo cp -rpfv /tmp/missing/* /
测试导入并显示版本
python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import sys
>>> print(sys.version_info)
sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0)
>>>
>>> quit()
rm -rf /tmp/missing
最有可能的是,您有许多处于“ reinstreq”卡住状态的软件包。
dpkg -s -a | grep reinstreq
# Any listing also needs to be reinstalled along with python3
apt-get install --reinstall python3
这时,您将必须手动重新安装apt-get autoclean
apt-get autoremove
(MANY PACKAGES FAILED TO BE INSTALLED)
...
apt-get autoremove
让我猜测,您遇到以下错误:
apt-get install --fix-broken --reinstall <list-of-many-failed-packages>
我会告诉您,您的E: Internal Error, No file name for XXXXXX
中可能有一段时间有较新的Debian版本,它全部降下来(不好),并从/etc/apt/sources.list
文件中取出了较新的版本(在努力恢复到“稳定”的发行版):这对我来说不是一件不可恢复的事情,只是您在Debian软件包数据库中四处抽了一下……相当残酷。
最后一步的解决方法是通过重新安装几乎所有内容来恢复和稳定Debian软件包管理数据库。我待会儿会详细介绍,但是后面的链接是here。
答案 2 :(得分:0)
试试这个:
首先删除不再需要的包:
sudo apt-get autoremove
清除检索到的包文件的本地存储库
sudo apt-get autoclean
删除软件包(未安装mysql-client):
sudo apt-get remove mysql-server mysql-common
答案 3 :(得分:0)
尽管/ usr / bin /中存在py3compile和py3clean,但我的Lubunutu 16.10 shell(tcsh)仍抱怨py3compile不在那里。经过几个小时的挫折,我发现pycompile的第一行是:
! /usr/bin/env python
或类似的东西,在我的系统上引用了Python2.7。将其更改为指向Python 3:
! /usr/local/bin/python3
突然让py3compile可见!
事实证明,当py3compile引用Python2.7时,shell表示py3compile不存在,即使它在路径中或直接用“ / usr / bin / py3compile ”执行。 shell甚至没有抱怨Python版本或任何东西,它只是声称py3compile本身不存在!
我遇到了这个烂摊子,因为我想删除并重新安装Python 3.5,我发现仍然有一个Python 3,然后我发现它来自python-minimal,我试图删除并重新安装。 python-minimal不会重新安装,即使我尝试了网上和每个包管理器上都可以找到的所有东西。他们都抱怨py3compile缺失。现在我发现了py3compile的这个修复程序。
答案 4 :(得分:0)
尝试
apt install-重新安装hplip hplip-data
之后
apt install-重新安装python3