广告
返回顶部
首页 > 资讯 > 数据库 >MAC安装mysqlclient失败,× Getting requirements to build wheel did not run successfully.│ exit code: 1╰─
  • 223
分享到

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

macosdjangopython 2023-09-25 12:09:02 223人浏览 独家记忆
摘要

问题: 在使用Django项目安装Mysqlclient时出现以下错误: Collecting mysqlclient Using cached mysqlclient-2.1.1.tar.gz (88 kB) Installing b

问题:

在使用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           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 "", line 15, in         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.

解决方案:

先去登录brew官网:

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

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

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

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

代码:

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

   

代码:

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

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

brew help确认是否安装好

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

$ brew install mysql$ pip install mysqlclient

紧接着就是搞定

 

Successfully built mysqlclientInstalling collected packages: mysqlclientSuccessfully installed mysqlclient-2.1.1

看到这个恭喜你! 

 

来源地址:https://blog.csdn.net/drunk_soul/article/details/130475845

您可能感兴趣的文档:

--结束END--

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

本文链接: https://www.lsjlt.com/news/417375.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作