
我看mysqlclient官方github上说了这个方法,我试了也可以:
1.$ brew info openssl
2.根据提示,设置
$ echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc
$ export LDFLAGS="-L/usr/local/opt/openssl/lib"
$ export CPPFLAGS="-I/usr/local/opt/openssl/include"
3.安装pip3 install mysqlclient
然后如果报错IndexError: string index out of range,是因为在新版本里的mysql_config少了--libmysqld-libs
macOS Sierra 上安装 mysqlclient 问题99.9% 的人不需要看这篇文章。我是说真的。 写在前面 好久没有写这种类型的文章了,记录遇到的具体问题。 随着搜索水平的提高,特别是英文搜索水平的提高,这种类型的文章感觉越...