无法安装python3的连续报错-mysql include软链接问题

作者:matrix 被围观: 7,975 次 发布时间:2019-03-12 分类:Python | 无评论 »

这是一个创建于 2111 天前的主题,其中的信息可能已经有所发展或是发生改变。

虚拟机ubuntu中自带了Python2,但是想要使用python3需要单独安装。使用add-apt-repository来添加ppa源安装提示command not found,之后进行安装操作sudo apt-get install software-properties-common,错误继续:

$ sudo apt-get install software-properties-common
Reading package lists... Done
Building dependency tree... 50%
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libmysql++-dev : Depends: libmysqlclient-dev but it is not going to be installed
 software-properties-common : Depends: python3:any (>= 3.3.2-2~)
                              Depends: python3 but it is not going to be installed
                              Depends: python3-gi but it is not going to be installed
                              Depends: gir1.2-glib-2.0 but it is not going to be installed
                              Depends: python-apt-common (>= 0.9) but it is not going to be installed
                              Depends: python3-dbus but it is not going to be installed
                              Depends: python3-software-properties (= 0.96.20.8) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

继续apt-get update & upgrade & 更换国内源,后面使用apt-get install python3也是相同错误,无济于事。
错误跟踪到libmysql++-dev依赖问题,遂重新安装sudo apt-get install libmysqlclient-dev:

$ sudo apt-get install libmysqlclient-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libmysqlclient-dev
0 upgraded, 1 newly installed, 0 to remove and 163 not upgraded.
4 not fully installed or removed.
Need to get 0 B/1,167 kB of archives.
After this operation, 7,040 kB of additional disk space will be used.
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 51891 files and directories currently installed.)
Preparing to unpack .../libmysqlclient-dev_5.7.25-0ubuntu0.16.04.2_amd64.deb ...
Unpacking libmysqlclient-dev (5.7.25-0ubuntu0.16.04.2) ...
dpkg: error processing archive /var/cache/apt/archives/libmysqlclient-dev_5.7.25-0ubuntu0.16.04.2_amd64.deb (--unpack):
 unable to install new version of '/usr/include/mysql/mysql/plugin_ftparser.h': No such file or directory
Errors were encountered while processing:
 /var/cache/apt/archives/libmysqlclient-dev_5.7.25-0ubuntu0.16.04.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

尝试手动安装deb:sudo dpkg -i /var/cache/apt/archives/libmysqlclient-dev_5.7.25-0ubuntu0.16.04.2_amd64.deb失败:

unable to install new version of '/usr/include/mysql/mysql/plugin_ftparser.h': No such file or directory

根源问题

/usr/include/mysql/mysql/plugin_ftparser.h不存在
开始手动查找

$ sudo find / | grep plugin_ftparser.h

图片4456-无法安装python3的连续报错-mysql include软链接问题

该文件只存在与/usr/local/mysql/include/目录中,ls /usr/include/mysql -al查看列表就会发现mysql的软链接出现问题导致的。
图片4458-无法安装python3的连续报错-mysql include软链接问题

解决

重新生成mysql include软连接

$ ln -s /usr/local/mysql/include /usr/include/mysql/mysql #重新生成软连接

图片4460-无法安装python3的连续报错-mysql include软链接问题

此虚拟机中的mysql是之前安装LNMP搭建PHP环境而创建的,很有可能和这个有关系。

参考:
https://askubuntu.com/questions/629448/file-mysql-h-cant-be-found
https://askubuntu.com/questions/773079/fixing-broken-packages-in-ubuntu-repost

PEACE~

其他文章:
本文固定链接:https://www.hhtjim.com/cant-install-python3-continuous-error-mysql-include-soft-links.html
matrix
本文章由 matrix 于2019年03月12日发布在Python分类下,目前没有通告,你可以至底部留下评论。
转载请注明:无法安装python3的连续报错-mysql include软链接问题-HHTjim'S 部落格
关键字:, ,

添加新评论 »

 🙈 😱 😂 😛 😭 😳 😀 😆 👿 😉 😯 😮 😕 😎 😐 😥 😡 😈 💡

插入图片

NOTICE: You should type some Chinese word (like “你好”) in your comment to pass the spam-check, thanks for your patience!