文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

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

2023-09-25 12:30

关注

问题:

在使用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

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯