Complete output from command python setup.py egg_info:
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/ww/hnzjh2z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/setup.py", line 17, in
metadata, options = get_config()
File "/private/var/folders/ww/hnzjh2z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/private/var/folders/ww/hnzjh2z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found
解决办法:
安装mysql-connector-c:
brew install mysql-connector-c
如果电脑没有安装brew,按照以下方式安装brew,再安装mysql-connector-c:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
002pc.com认为此文章对《Mac 安装mysqlclient报错,OSError: mysql_config not found 的解决方法》说的很在理。再次安装mysqlclient:
pip install mysqlclient
发现报了一个新的错误:
Collecting mysqlclient
Using cached mysqlclient-1.3.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/rv/a_a/T/pip-build-nyaa8t95/mysqlclient/setup.py", line 17, in
metadata, options = get_config()
File "/private/var/folders/rv/a_a/T/pip-build-nyaa8t95/mysqlclient/setup_posix.py", line 54, in get_config
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
File "/private/var/folders/rv/a_a/T/pip-build-nyaa8t95/mysqlclient/setup_posix.py", line 54, in
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
File "/private/var/folders/rv/a_a/T/pip-build-nyaa8t95/mysqlclient/setup_posix.py", line 12, in dequote
if s[0] in ""'" and s[0] == s[-1]:
IndexError: string index out of range
解决办法:修改mysql-config文件:
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"
#保存
再次安装mysqlclient:
pip install mysqlclient
成功!
更多:Mac 安装mysqlclient报错,OSError: mysql_config not found 的解决方法
https://www.002pc.comhttps://www.002pc.com/mysql/2312.html
你可能感兴趣的报错,OSError,config,mysqlclient,Mac,mysql
No alive nodes found in your cluster
0踩
赏
1 赞