十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
本文主要给大家简单讲讲mac下安装MySQLclient报错怎么处理,相关专业术语大家可以上网查查或者找一些相关书籍补充一下,这里就不涉猎了,我们就直奔主题吧,希望mac下安装mysqlclient报错怎么处理这篇文章可以给大家带来一些实际帮助。
专注于为中小企业提供做网站、成都做网站服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业渝水免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了成百上千企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
命令如下:
$ pip3 install mysqlclient
pip3是因为有两个python版本,给python3.6对应的pip起了个别名。不然提示找不到。
报错如下:
Collecting mysqlclient Using cached mysqlclient-1.3.12.tar.gz 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/hnzjh3z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/setup.py", line 17, in metadata, options = get_config() File "/private/var/folders/ww/hnzjh3z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/setup_posix.py", line 44, in get_config libs = mysql_config("libs_r") File "/private/var/folders/ww/hnzjh3z517d72m15ybyhwkbw0000gn/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 ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/ww/hnzjh3z517d72m15ybyhwkbw0000gn/T/pip-build-mvq09hkr/mysqlclient/
解决方法:
1、在~/.bash_profile中加入mysql.的路径
$ cat ~/.bash_profile # 添加/usr/local/mysql/bin set PATH /Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/mysql/bin export PATH
2、安装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)"
3、再次安装
$ pip3 install mysqlclient
mac下安装mysqlclient报错怎么处理就先给大家讲到这里,对于其它相关问题大家想要了解的可以持续关注我们的行业资讯。我们的板块内容每天都会捕捉一些行业新闻及专业知识分享给大家的。