【Django】Mac 安装pip3-install-mysqlclient 报错
1.首先在pip3-install-mysqlclient时报错
mysql_config not found
2.逛了一些博客 让安装mysql或者mysql-connector-c
我安装了后者还是报错,现在报了这个错误
File "<string>", line 1, in <module> File "/private/var/folders/2f/r1pwfcp521q7z9kd240tr3700000gn/T/pip-build-u8yhUI/mysqlclient/setup.py", line 17, in <module> 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"