安装django用到mysqldb
pip install MySQL-python
报错
EnvironmentError: mysql_config not found
解决办法
export PATH="/usr/local/mysql/bin:$PATH"
然后继续安装
sudo pip install MySQL-python
安装成功
运行django
python manage.py runserver
接下来又出问题了
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib Referenced from: /Library/Python/2.7/site-packages/_mysql.so Reason: image not found
解决方法
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.lib /usr/lib/libmysqlclient.18.dylib