无法在 Ubuntu 19.04 中卸载 mysql-connector-python

无法在 Ubuntu 19.04 中卸载 mysql-connector-python

我的 Java 先生让我安装 MySQL 服务器、工作台和连接器。我花了 30 多个小时阅读不同的帖子后,不知怎么就安装好了。

启动 Workbench 后,我转到“工具”>“启动 Shell 以查看 MySQL 实用程序”。弹出以下窗口:https://i.stack.imgur.com/9fHso.jpg

按“下载”选项后,我被重定向到网站: https://i.stack.imgur.com/OeAPy.jpg

安装此软件包后,每当我运行:sudo apt 更新,我收到此错误:

pranav@inspiron-5548:~$ sudo apt-get upgrade
[sudo] password for pranav: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
  mysql-connector-python
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 1,362 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 216555 files and directories currently installed.)
Removing mysql-connector-python (8.0.16-1ubuntu19.04) ...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'distutils.sysconfig'
dpkg: error processing package mysql-connector-python (--remove):
 installed mysql-connector-python package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
 mysql-connector-python
E: Sub-process /usr/bin/dpkg returned an error code (1)

所以,我想我应该卸载它,然后我用 sudo apt-get remove --purge mysql-connector-python命令,但它也不起作用,并且它抛出了与上述相同的错误。

该怎么办?我现在处于困境之中!由于“mysql-utilities”中所做的任何新开发都可追溯到 2017 年 1 月 17 日,我认为我不再需要它了。我犯了一个错误,试图安装旧的存档 deb 包。(新手)

如果您知道如何删除它、它是什么,请告诉我,这将非常有帮助。

答案1

正常情况下 sudo apt autoremove应该可以工作,但在这种情况下,我使用这个命令来解决同样的问题:

sudo mv /var/lib/dpkg/info/mysql-connector-python* /tmp

使用上述命令后,sudo apt autoremove再次使用即可解决所有问题。

有关此问题的更多详细信息,请访问地点。

相关内容