MAC安装mysqlclient失败,× Getting requirements to build wheel did not run successfully.│ exit code: 1╰─

这篇具有很好参考价值的文章主要介绍了MAC安装mysqlclient失败,× Getting requirements to build wheel did not run successfully.│ exit code: 1╰─。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

问题:

在使用django项目安装mysqlclient时出现以下错误:

Collecting mysqlclient
  Using cached mysqlclient-2.1.1.tar.gz (88 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      /bin/sh: mysql_config: command not found
      /bin/sh: mariadb_config: command not found
      /bin/sh: mysql_config: command not found
      mysql_config --version
      mariadb_config --version
      mysql_config --libs
      Traceback (most recent call last):
        File "/Users/ww/IT/PycharmProject/pyproject/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/ww/IT/PycharmProject/pyproject/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/ww/IT/PycharmProject/pyproject/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/w6/3qy3y8294l9bv15sxd54n0mm0000gn/T/pip-build-env-w6vliiy5/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/private/var/folders/w6/3qy3y8294l9bv15sxd54n0mm0000gn/T/pip-build-env-w6vliiy5/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/w6/3qy3y8294l9bv15sxd54n0mm0000gn/T/pip-build-env-w6vliiy5/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/private/var/folders/w6/3qy3y8294l9bv15sxd54n0mm0000gn/T/pip-build-env-w6vliiy5/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 15, in <module>
        File "/private/var/folders/w6/3qy3y8294l9bv15sxd54n0mm0000gn/T/pip-install-9ai0k4t1/mysqlclient_68c540255d6b42808120a9e63553ac4d/setup_posix.py", line 70, in get_config
          libs = mysql_config("libs")
        File "/private/var/folders/w6/3qy3y8294l9bv15sxd54n0mm0000gn/T/pip-install-9ai0k4t1/mysqlclient_68c540255d6b42808120a9e63553ac4d/setup_posix.py", line 31, in mysql_config
          raise OSError("{} not found".format(_mysql_config_path))
      OSError: mysql_config not found
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

解决方案:

1、先去登录brew官网:

macOS(或 Linux)缺失的软件包的管理器 — Homebrew

复制以下代码,到mac终端运行:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

安装好后根据提示运行一下两端代码:

1、代码:

(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/ww/.zprofile

   

2、代码:

eval "$(/opt/homebrew/bin/brew shellenv)"

终端运行完后,确认brew已经安装完毕可以启动

brew help确认是否安装好

好了后,继续运行这两段代码:

$ brew install mysql
$ pip install mysqlclient

紧接着就是搞定

 文章来源地址https://www.toymoban.com/news/detail-630400.html

Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-2.1.1

看到这个恭喜你! 

 

到了这里,关于MAC安装mysqlclient失败,× Getting requirements to build wheel did not run successfully.│ exit code: 1╰─的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包