文章内容
2019/11/4 16:42:32,作 者: 黄兵
ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory
今天在部署一个博客的时候出现了如下错误:
ImportError: libmysqlclient.so.20: cannot open shared object file: No such file or directory
具体错误截图如下:
出现问题的原因:
应该是MySQL-python
安装的有问题,需要重新安装。
使用如下命令重新安装:
sudo apt-get install libmysqlclient-dev
但是在安装的时候又报如下错误:
EnvironmentError: mysql_config not found
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
出现这个问题的主要原因:
系统上缺少mysql_config
,安装程序找不到它。确保安装了mysql_config
。
使用如下命令安装mysql_config
:
sudo apt-get install libmysqlclient-dev
对于最近版本的Ubuntu(Ubuntu 18.04),执行如下命令:
sudo apt install default-libmysqlclient-dev
之后再次执行上面命令,安装成功。
参考资料:
1、pip install mysql-python fails with EnvironmentError: mysql_config not found
2、Upgraded to Ubuntu 16.04 now MySQL-python dependencies are broken
黄兵个人博客原创。
评论列表