美文网首页
mac安装mysqlclient报错

mac安装mysqlclient报错

作者: 张东山 | 来源:发表于2022-06-23 14:54 被阅读0次

    报错如下

    ImportError: dlopen(/Users/john/PycharmProjects/llknew/venv/lib/python3.10/site-packages/MySQLdb/_mysql.cpython-310-darwin.so, 2): Library not loaded: @rpath/libmysqlclient.21.dylib
    Referenced from: /Users/john/PycharmProjects/llknew/venv/lib/python3.10/site-packages/MySQLdb/_mysql.cpython-310-darwin.so
    Reason: image not found

    解决方法

    进入到虚拟环境venv的这个目录下
    venv/lib/python3.10/site-packages/MySQLdb
    然后执行命令
    otool -L _mysql.cpython-310-darwin.so
    然后执行命令
    install_name_tool -change @rpath/libmysqlclient.21.dylib /usr/local/mysql/lib/libmysqlclient.21.dylib _mysql.cpython-310-darwin.so  
    

    再试试

    问题解决

    相关文章

      网友评论

          本文标题:mac安装mysqlclient报错

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