Luk*_*asz 7 mysql macos mysql-python python-3.x
我\xe2\x80\x99m 尝试在我的配备M1 芯片的MacBook 上安装MySQL 的Python 接口(mysqlclient 2.1.0),以便与Django 项目(将在MS Code 中开发)一起使用。当我\xe2\x80\x99m 尝试为python 安装mysqlclient 时,出现错误并且I\xe2\x80\x99m 无法解决它。我见过其他人有类似的问题,但根据我从下面得到的错误文本判断,我的问题并不相同
\n请帮忙
\n我的系统详细信息:MAC (M1)、OS Monterey 12.3、终端 zsh
\nLast login: Fri Mar 18 09:16:39 on ttys000\n/Users/luklys/.zshrc:18: command not found: Password:\nluklys@Luklys-MacBook-Air ~ % cd Documents/Code\\ Projects/hello_django \nluklys@Luklys-MacBook-Air hello_django % python3 -m venv .myvenv\nluklys@Luklys-MacBook-Air hello_django % source .myvenv/bin/activate\n(.myvenv) luklys@Luklys-MacBook-Air hello_django %\nRun Code Online (Sandbox Code Playgroud)\n(.myvenv) luklys@Luklys-MacBook-Air hello_django % brew install mysql-client\nWarning: mysql-client 8.0.28 is already installed and up-to-date.\nTo reinstall 8.0.28, run:\n  brew reinstall mysql-client\n(.myvenv) luklys@Luklys-MacBook-Air hello_django %\n\n(.myvenv) luklys@Luklys-MacBook-Air hello_django % echo \'export PATH="/usr/local/opt/mysql-client/bin:$PATH"\' >> ~/.zshrc       \n(.myvenv) luklys@Luklys-MacBook-Air hello_django % export PATH="/usr/local/opt/mysql-client/bin:$PATH"\n\nRun Code Online (Sandbox Code Playgroud)\n(.myvenv) luklys@Luklys-MacBook-Air hello_django % pip install mysqlclient\nCollecting mysqlclient\n  Using cached mysqlclient-2.1.0.tar.gz (87 kB)\n  Preparing metadata (setup.py) ... error\n  error: subprocess-exited-with-error\n  \n  \xc3\x97 python setup.py egg_info did not run successfully.\n  \xe2\x94\x82 exit code: 1\n  \xe2\x95\xb0\xe2\x94\x80> [16 lines of output]\n      /bin/sh: mysql_config: command not found\n      /bin/sh: mariadb_config: command not found\n      /bin/sh: mysql_config: command not found\n      Traceback (most recent call last):\n        File "<string>", line 2, in <module>\n        File "<pip-setuptools-caller>", line 34, in <module>\n        File "/private/var/folders/pw/87hvnxc51gdcwf3ck25n95tw0000gn/T/pip-install-y_1qn9ke/mysqlclient_48574969a7ff4372b5ff326147c56ec6/setup.py", line 15, in <module>\n          metadata, options = get_config()\n        File "/private/var/folders/pw/87hvnxc51gdcwf3ck25n95tw0000gn/T/pip-install-y_1qn9ke/mysqlclient_48574969a7ff4372b5ff326147c56ec6/setup_posix.py", line 70, in get_config\n          libs = mysql_config("libs")\n        File "/private/var/folders/pw/87hvnxc51gdcwf3ck25n95tw0000gn/T/pip-install-y_1qn9ke/mysqlclient_48574969a7ff4372b5ff326147c56ec6/setup_posix.py", line 31, in mysql_config\n          raise OSError("{} not found".format(_mysql_config_path))\n      OSError: mysql_config not found\n      mysql_config --version\n      mariadb_config --version\n      mysql_config --libs\n      [end of output]\n  \n  note: This error originates from a subprocess, and is likely not a problem with pip.\nerror: metadata-generation-failed\n\n\xc3\x97 Encountered error while generating package metadata.\n\nRun Code Online (Sandbox Code Playgroud)\n