Mac解决pip3 install mysqlclient失败问题

  • Post author:
  • Post category:mysql


一、mac OSError: mysql_config not found。

1.安装brew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"  

2.安装mysql-connector-c

brew install mysql-connector-c

3.配置路径

PATH="$PATH":/usr/local/Cellar/mysql-client/8.0.18/bin/

如果再次安装出现IndexError: string index out of range

cd /usr/local/Cellar/mysql-connector-c/6.1.11/bin/  
# 备份  
cp  mysql_config mysql_config.bak     
chmod u+w mysql_config  
vi mysql_config  

#   :114    找到第114行  
# 将  
#  libs="$libs -l "  
# 替换为  
#  libs="$libs -lmysqlclient -lssl -lcrypto"  
#保存  

二、error: command ‘gcc’ failed with exit status

1.安装gcc

brew install gcc

三、ld: library not found for -lssl

clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: command ‘gcc’ failed with exit status 1

1.通过其他方式下载mysql client

LDFLAGS=-L/usr/local/opt/openssl/lib pip3 install mysqlclient



版权声明:本文为qq_36294284原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。