Ubuntu安装MySQLdb报错:django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: libmys

环境:ubuntu14+python2.7+django1.8+mysql5.7

当初部署环境是碰到的一个错误:

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient.so.18: cannot open shared object file: No such file or directory

被折磨半天,各种搜索,发现主要是发生在centos上,这就很伤心,最后一通瞎操作不知道怎么就好了,抽空赶紧做个docker保命,配环境太痛苦。

感觉好像是系统中安装了python-mysqldb搞好的,然后在再Python环境中安装python-mysqldb

1、安装系统级别的python-mysqldb

sudo apt-get install python-mysqldb

2、安装几个依赖 ,好像是这样。。。

sudo apt-get install build-essential python-dev libmysqlclient-dev

3、最后在安装Python环境中的MySQL-python

pip install MySQL-python

参考: 

https://stackoverflow.com/questions/7459766/installing-mysql-python

https://blog.csdn.net/huludan/article/details/65443869

https://blog.51cto.com/11026142/1840572

你可能感兴趣的:(Ubuntu安装MySQLdb报错:django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: libmys)