添加mysql软连接失败_无法安装python3的连续报错-mysql include软链接问题

作者:matrix

被围观: 6,647 次

发布时间:2019-03-12

无评论 »

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

虚拟机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

36d394262e64614155ed9fad2335c4f1.png

该文件只存在与/usr/local/mysql/include/目录中,ls /usr/include/mysql -al查看列表就会发现mysql的软链接出现问题导致的。

3ba697faa5b3ef83db5ea12ba88dbe66.png

解决

重新生成mysql include软连接

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

ba7d206356fadeb503a16f9a1218efe2.png

此虚拟机中的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~


版权声明:本文为weixin_40002224原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。