本文介绍了无法在MacOS Sierra上使用pip3安装mysqlclient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在django中使用mysql,因此尝试使用$ pip3 install mysqlclient
下载mysqlclent,但总是出现此错误
I want to use mysql in django so, trying to download mysqlclent using $ pip3 install mysqlclient
but always this error comes up
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/hb/vmtpfjk12fdcm_8l95hfqzmr0000gn/T/pip-build-pm_wn_w8/mysqlclient/
这是我的终端日志
$ pip3 install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.9.tar.gz
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/hb/vmtpfjk12fdcm_8l95hfqzmr0000gn/T/pip-build-pm_wn_w8/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/private/var/folders/hb/vmtpfjk12fdcm_8l95hfqzmr0000gn/T/pip-build-pm_wn_w8/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/private/var/folders/hb/vmtpfjk12fdcm_8l95hfqzmr0000gn/T/pip-build-pm_wn_w8/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/hb/vmtpfjk12fdcm_8l95hfqzmr0000gn/T/pip-build-pm_wn_w8/mysqlclient/
请帮助
推荐答案
$ pip3 install mysqlclient
表示您打算使用Python3安装该软件包.根据描述中的错误,我认为您的计算机上可能缺少MySQL.根据 mysqlclient存储库,MySQLConnectorC是在OSX上运行mysqlclient的先决条件之一.
indicates that you are intending to use Python3 install the package. Based on the errors in the description, I believe that MySQL maybe missing from your machine. According to mysqlclient repo, MySQLConnectorC is one of the prerequisite to run mysqlclient on OSX.
brew install mysql-connector-c
应该解决您的问题.
这篇关于无法在MacOS Sierra上使用pip3安装mysqlclient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!