zoukankan      html  css  js  c++  java
  • mac 解决mysqlclient安装失败问题

    环境 mac
    本人下载mysql 是采用brew 下载,所以安装路径在/usr/local/Cellar/mysql/8.0.19_1/

    brew install mysql
    brew install mysql-connector-c
    sudo sed -i -e 's/libs="$libs -l "/libs="$libs -lmysqlclient -lssl -lcrypto"/g' /usr/local/mysql/bin/mysql_config
    下载mysql-client
    brew install mysql-client
    路径在:/usr/local/Cellar/mysql-client/8.0.19/

    采用Django启动项目报错
    django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.

    Did you install mysqlclient?

    下载mysqlclient
    pip install mysqlclient
    下载时报错
    报错 1:
    _mysql.c:29:10: fatal error: 'my_config.h' file not found

    #include "my_config.h"
    
             ^~~~~~~~~~~~~
    
    1 error generated.
    
    error: command '/usr/bin/clang' failed with exit status 1
    

    解决办法:
    export DYLD_LIBRARY_PATH="/usr/local/Cellar/mysql/8.0.19_1/lib"
    本人是采用brew 下载mysql 的,所以。存储路径是/usr/local/Cellar/mysql/8.0.19_1/ 。

    报错2
    File "/private/var/folders/wy/4v8w8ht90m7_1xzxklx1tnsm0000gn/T/pip-install-bbm57hwr/mysqlclient/setup_posix.py", line 47, in get_config

        libs = mysql_config("libs_r")
    
      File "/private/var/folders/wy/4v8w8ht90m7_1xzxklx1tnsm0000gn/T/pip-install-bbm57hwr/mysqlclient/setup_posix.py", line 29, in mysql_config
    
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    
    OSError: mysql_config not found
    
    ----------------------------------------
    

    ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    解决办法:
    export PATH=$PATH:/usr/local/Cellar/mysql/8.0.s19_1/bin

    报错3:
    ld: library not found for -lssl

    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    error: command '/usr/bin/clang' failed with exit status 1
    

    解决办法:
    export PATH="/usr/local/Cellar/mysql-client/8.0.19/bin:$PATH"
    至此下载成功。

  • 相关阅读:
    函数的命名空间和作用域
    python 各个地方导航(方便查询,持续更新!)
    零基础学虚幻4(UE4):蓝图+VR 丁树凯教程
    UE4打包后的游戏,无法打卡其他关卡的解决办法
    【精辟】进制转换
    Git仓库的初始化
    【编程】杂碎知识点
    MFC制作带界面的DLL库
    StartImage.DLL使用说明
    MFC对话框程序:实现程序启动画面
  • 原文地址:https://www.cnblogs.com/heych/p/13060945.html
Copyright © 2011-2022 走看看