新 mac 安装django 使用 mysql
brew install mysql
PATH=$PATH:/usr/local/mysql-8.0.18-macos10.14-x86_64/bin
来源: https://github.com/clips/pattern/issues/203#issuecomment-370156606
或者
brew install mysql-client
# mysql-client is not on the `PATH` by default
export PATH="/usr/local/opt/mysql-client/bin:$PATH"
# openssl is not on the link path by default
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
运行django 又出问题
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
运行:
pip install --force-reinstall --ignore-installed --no-binary :all: mysqlclient
成功了。
看国内一百个博客有99个都是修改 django __init__.py
添加 import mysql xxxx懒得写了
,然后修改库文件,把 pymysql 版本限制修改掉。这是很不靠谱的,哪里有写代码需要修改库文件的?
网友评论