美文网首页@ IT·测试
MacOS10.15.5安装mysqlclient报错

MacOS10.15.5安装mysqlclient报错

作者: 码上版码 | 来源:发表于2020-06-06 00:29 被阅读0次
    image.png

    解决方法:

    解决方法如下:

    1)首先需要进行Python的安装

    ~/.bash_profile加入mysql.的路径

    添加/usr/local/mysql/bin

    PATH /Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/mysql/bin
    export PATH

    设置python3.6默认

    alias python="/usr/local/bin/python3.6"
    2)安装Homebrew:Mac OS X 10.15.5 安装 HomeBrew

    3)安装mysql:Mac OS X 10.15.5安装mysql8.0.11
    4)设置环境变量:
    export PATH=$PATH:/usr/local/mysql/bin

    5)安装 brew install mysql-connector-c

    image.png

    先安装homebrew,参考文档“安装Homebrew”

    终端输入:brew install mysql-connector-c

    image.png

    安装成功

    配置环境变量
    export PATH="/usr/local/opt/mysql-client/bin:PATH"export LIBRARY_PATH="LIBRARY_PATH:/usr/local/opt/openssl/lib/"

    image.png
    6)找不到mysql_config一般是由于通过lnmp.org或者其他方式安装mysql以后mysql_config是在/usr/local/mysql/bin/里面,这里面的文件不是在任意位置都可以访问的

    终端输入:ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config

    vim mysql_config

    Create options

    libs="-Lpkglibdir" libs="libs -l "
    修改为

    Create options

    libs="-Lpkglibdir" libs="libs -lmysqlclient -lssl -lcrypto"
    保存退出
    7)安装pip3 install mysqlclient==1.3.12

    image.png

    相关文章

      网友评论

        本文标题:MacOS10.15.5安装mysqlclient报错

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