Mac解决pip3 install mysqlclient失败问题

一、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
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值