【问题标题】:pip install mysqlclient failed: sys/types.h: no such file or directorypip install mysqlclient failed: sys/types.h: no such file or directory
【发布时间】:2019-10-25 06:39:49
【问题描述】:

pip install mysqlclient failed: fatal error: sys/types.h: no such file or directory...command 'gcc' failed with exit status 1

我正在使用 sqlalchemy 为 mysql 创建引擎。收到错误“ImportError:没有名为 MySQLdb 的模块”。然后我尝试 pip install mysqlclient 但遇到了这个问题。根据我的研究,sys/types.h 应该在 /usr/include/sys 中找到,但我在 /usr 中没有包含文件夹。尝试 brew install mysql-connector-c 成功但没有解决问题。

我使用的是 macOS Mojave(V10.14)

【问题讨论】:

    标签: mysql-python


    【解决方案1】:

    下面这个命令很多地方都提出了,但是最新版本没有安装头文件。

    $ xcode-select --install
    

    因此,您还需要执行以下命令来安装这些标头:

    $ sudo /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
    

    【讨论】:

      猜你喜欢
      • 2014-09-04
      • 2021-11-16
      • 2023-04-03
      • 2020-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-05
      • 2019-07-23
      相关资源
      最近更新 更多