简体   繁体   English

无法在 mac 上安装 mysqlclient

[英]unable to install mysqlclient on mac

I'm attempting to install mysqlclient using the command:我正在尝试使用以下命令安装 mysqlclient:

pip install mysqlclient but i get the following error: pip install 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 "<string>", line 1, in <module>
      File "/private/var/folders/8d/xdwdnphs1w5b_vtxrc67__5h0000gn/T/pip-build-ifu54299/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/private/var/folders/8d/xdwdnphs1w5b_vtxrc67__5h0000gn/T/pip-build-ifu54299/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/private/var/folders/8d/xdwdnphs1w5b_vtxrc67__5h0000gn/T/pip-build-ifu54299/mysqlclient/setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found

I uninstalled python3 using brew uninstall --force python3 and downloaded the binary from pythons website but to no avail.我使用brew uninstall --force python3并从 pythons 网站下载了二进制文件,但无济于事。 I also attempted to download mysql connector from oracle website and again to no avail.我还尝试从 oracle 网站下载 mysql 连接器,但再次无济于事。 I have tried upgrading pip again still doesnt work.我已经尝试再次升级 pip 仍然不起作用。

PS mysql is running in a docker container and i'm running django on my local machine. PS mysql 在 docker 容器中运行,我在本地机器上运行 django。

Any suggestions on why i'm getting an error attempting to install mysqlclient关于为什么我在尝试安装 mysqlclient 时遇到错误的任何建议

For Python I can recommend pymysql is pretty good and I always use it.对于 Python,我可以推荐 pymysql 非常好,我总是使用它。 https://github.com/PyMySQL/PyMySQL https://github.com/PyMySQL/PyMySQL

or you can follow this answer或者你可以按照这个答案

Installing MySQL Python on Mac OS X 在 Mac OS X 上安装 MySQL Python

you need to install mysql and mysql connector before install my sql client在安装我的 sql 客户端之前,您需要安装 mysql 和 mysql 连接器

brew install mysql酿造安装mysql

brew install mysql-connector-c brew install mysql-connector-c

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM