gpt4 book ai didi

django - mysqlclient在mac os上的python3中安装

转载 作者:行者123 更新时间:2023-12-04 01:35:48 24 4
gpt4 key购买 nike

在python3系统安装mysqlclient报错

命令pip3安装mysqlclient

错误:命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出。

ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/pip-egg-info
cwd: /private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/
Complete output (12 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "/private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/setup_posix.py", line 61, in get_config
libs = mysql_config("libs")
File "/private/var/folders/tj/vjwl0qpd6l5ct6bdjgwyk1rh0000gp/T/pip-install-abwz3tky/mysqlclient/setup_posix.py", line 29, in mysql_config
raise EnvironmentError("%s not found" % (_mysql_config_path,))
OSError: mysql_config not found
----------------------------------------

最佳答案

您是否安装了 mysqlclient 所需的先决条件? ?

macOS (Homebrew)

Install MySQL and mysqlclient:

Assume you are activating Python 3 venv

$ brew install mysql

$ pip install mysqlclient

If you don't want to install MySQL server, you can use mysql-client instead:

Assume you are activating Python 3 venv

$ brew install mysql-client

$ echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile

$ export PATH="/usr/local/opt/mysql-client/bin:$PATH"

$ pip install mysqlclient

关于django - mysqlclient在mac os上的python3中安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59624154/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com