我有一个正在运行的django项目,由于某些原因我不得不删除当前的mysql版本并在我的机器中安装不同的MySQL版本.
但是现在当我试图运行这个程序时出现如下错误:
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient.so.20: cannot open shared object file: No such file or directory
小智.. 18
重新安装c共享库:
pip uninstall mysql-python pip install mysql-python
小智.. 17
我的问题与相同的错误消息是mysql环境不是所有的方式设置.我需要卸载MySQL-python; 安装libmysqlclient-dev; 重新安装MySQL-python来纠正这个问题.
所以解决方案也是如此:
sudo pip卸载MySQL-python(从您选择的包管理器卸载)
sudo apt-get install libmysqlclient-dev
sudo pip安装MySQL-python
**我还应该提一下,我使用pip install的--no-cache-dir选项直接命中PYPI,这有助于发现以下内容:
sh: 1: mysql_config: not found Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-Y7RFpJ/mysql-python/setup.py", line 17, in metadata, options = get_config() File "/tmp/pip-build-Y7RFpJ/mysql-python/setup_posix.py", line 43, in get_config libs = mysql_config("libs_r") File "/tmp/pip-build-Y7RFpJ/mysql-python/setup_posix.py", line 25, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found
并带我到这里
使用:mysql 5.7,mysql-python 1.2.5,django 1.8.9,ubuntu 16.04
重新安装c共享库:
pip uninstall mysql-python pip install mysql-python
我的问题与相同的错误消息是mysql环境不是所有的方式设置.我需要卸载MySQL-python; 安装libmysqlclient-dev; 重新安装MySQL-python来纠正这个问题.
所以解决方案也是如此:
sudo pip卸载MySQL-python(从您选择的包管理器卸载)
sudo apt-get install libmysqlclient-dev
sudo pip安装MySQL-python
**我还应该提一下,我使用pip install的--no-cache-dir选项直接命中PYPI,这有助于发现以下内容:
sh: 1: mysql_config: not found Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-Y7RFpJ/mysql-python/setup.py", line 17, in metadata, options = get_config() File "/tmp/pip-build-Y7RFpJ/mysql-python/setup_posix.py", line 43, in get_config libs = mysql_config("libs_r") File "/tmp/pip-build-Y7RFpJ/mysql-python/setup_posix.py", line 25, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found
并带我到这里
使用:mysql 5.7,mysql-python 1.2.5,django 1.8.9,ubuntu 16.04