1.首先在pip3-install-mysqlclient时报错

mysql_config not found

2.逛了一些博客 让安装mysql或者mysql-connector-c

我安装了后者还是报错,现在报了这个错误

File "", line 1, in

File "/private/var/folders/2f/r1pwfcp521q7z9kd240tr3700000gn/T/pip-build-u8yhUI/mysqlclient/setup.py", line 17, in

metadata, options = get_config()

File "setup_posix.py", line 54, in get_config

libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]

File "setup_posix.py", line 12, in dequote

if s[0] in ""'" and s[0] == s[-1]:

IndexError: string index out of range

3.最后解决方法是修改本地的mysql_config  mac的路径:/usr/local/bin/mysql_config

vi进行修改:

# Create options

libs="-L$pkglibdir"

libs="$libs -l "

# 修改后,如下

# Create options

libs="-L$pkglibdir"

libs="$libs -lmysqlclient -lssl -lcrypto"

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐