无法安装python3的连续报错-mysql include软链接问题
作者:matrix 被围观: 7,092 次 发布时间:2019-03-12 分类:Python | 无评论 »
这是一个创建于 1269 天前的主题,其中的信息可能已经有所发展或是发生改变。
虚拟机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
不存在
开始手动查找
代码语言:javascript复制$ sudo find / | grep plugin_ftparser.h
该文件只存在与/usr/local/mysql/include/
目录中,ls /usr/include/mysql -al
查看列表就会发现mysql
的软链接出现问题导致的。
解决
重新生成mysql include软连接
代码语言:javascript复制$ ln -s /usr/local/mysql/include /usr/include/mysql/mysql #重新生成软连接
此虚拟机中的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~