美文网首页
2020-01-13 mac os 上安装MySQLdb报sh:

2020-01-13 mac os 上安装MySQLdb报sh:

作者: 多吃水果少吃肉 | 来源:发表于2020-01-13 14:50 被阅读0次

    新 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/"
    

    来源: https://stackoverflow.com/questions/43612243/install-mysqlclient-for-django-python-on-mac-os-x-sierra?answertab=votes#tab-top

    运行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 版本限制修改掉。这是很不靠谱的,哪里有写代码需要修改库文件的?

    相关文章

      网友评论

          本文标题:2020-01-13 mac os 上安装MySQLdb报sh:

          本文链接:https://www.haomeiwen.com/subject/ieagactx.html