• 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 函数知识点
    面向对象相关
    判断arg参数是否是可以被调用的
    利用U盘安装CentOS7系统
    简单模仿OpenGL中的栈的作用
    温故而知新我再一次学习库
    关于帧缓存的总结
    OGRE的相关工具和库
    OpenGL在Qt界面下的应用(helloworld)
    OpenGL加载Cg程序
  • 原文地址:https://www.cnblogs.com/heych/p/13060945.html
Copyright © 2020-2023  润新知