/bin/sh: mysql_config: command not found

mac下pip install -r requirements.txt安装mysqlclient报错


```bash
Collecting mysqlclient==2.1.1 (from -r requirements.txt (line 17))
  Using cached mysqlclient-2.1.1.tar.gz (88 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      /bin/sh: mysql_config: command not found
      /bin/sh: mariadb_config: command not found
      /bin/sh: mysql_config: command not found
      OSError: mysql_config not found
      mysql_config --version
      mariadb_config --version
      mysql_config --libs
      [end of output]

主要报错信息:

      /bin/sh: mysql_config: command not found
      /bin/sh: mariadb_config: command not found
      /bin/sh: mysql_config: command not found
      OSError: mysql_config not found

我安装的是mysql8.0,在vscode终端输入mysql提示找不到
添加mysql路径后在编辑器终端进行测试,提示如下证明OK了

 % PATH="$PATH":/usr/local/mysql/bin
 % mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

主要原因是没有设置环境变量导致无法识别路径

猜你喜欢

转载自blog.csdn.net/weixin_43883625/article/details/131936043