双色球机选号码投注
当前位置:首页 » Mysql技术教程

Mac 安装mysqlclient报错,OSError: mysql_config not found 的解决方法

2018-06-19 08:21 本站整理 浏览(59)

Complete output from command python setup.py egg_info:

/bin/sh: mysql_config: command not found

Traceback (most recent call last):

? File "<string>", line 1, in <module>

? File "/private/var/folders/ww/hnzjh2z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/setup.py", line 17, in <module>

? ? 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)"

?

?

再次安装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 "<string>", line 1, in <module>

? ? ? File "/private/var/folders/rv/a_a/T/pip-build-nyaa8t95/mysqlclient/setup.py", line 17, in <module>

? ? ? ? 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 <listcomp>

? ? ? ? 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

?

成功!

?

双色球机选号码投注 重庆时时彩国家不管吗 快三怎么看大小单双 麻将技巧顺口溜 大乐透最后投注时间 澳门新葡亰游戏网址 通比牛牛下载 彩票大赢家手机 澳客彩票网 天下彩票免费资枓大全 球探网足球比分