pip在Mac

时间:2019-11-16 23:16:14

标签: python mysql django pip

当我尝试为python pip安装mysqlclient时显示此错误

  ERROR: Command errored out with exit status 1:
 command: /Users/als/Desktop/Projects/sin/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/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/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/pip-egg-info
     cwd: /private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/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/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup.py", line 16, in <module>
    metadata, options = get_config()
  File "/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup_posix.py", line 61, in get_config
    libs = mysql_config("libs")
  File "/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup_posix.py", line 29, in mysql_config
    raise EnvironmentError("%s not found" % (_mysql_config_path,))
OSError: mysql_config not found
----------------------------------------

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

1 个答案:

答案 0 :(得分:-1)

要解决此问题,只需执行两个步骤:

  1. brew install mysql
  2. LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient