2
1

More than 1 year has passed since last update.

仮想環境下でpip install mysqlclientしたらERROR: Failed building wheel for mysqlclientが出た

Posted at

目的

djangoでアプリ作成するためのDBをsqliteではなく、人気のMySQLにしようとしてそのために必要なmysqlclientというドライバをインストールしようとしている。

結論

conda install -c anaconda mysql-connector-python
conda install -c bioconda mysqlclient

anacondaを利用しているなら、この処理が必要となるようだ

実施環境

ハードウェア環境

項目 情報
OS macOS Catalina(10.15.7)
ハードウェア MacBook Air (11-inch, Early 2015)
プロセッサ 1.6 GHz デュアルコアIntel Core i5
メモリ 4 GB 1600 MHz DDR3
グラフィックス intel HD Graphics 6000 1536 MB

ソフトウェア環境

項目 情報
homebrew 3.3.8
mysql Ver 8.0.27 for macos10.15 on x86_64
python 3.8.12
django 3.1.2
anaconda 4.10.1
pip 21.2.4

経緯

pip install mysqlclient

でちょちょっとドライバ入れさせてもろて〜と思ってたら、赤文字でめっちゃ長いエラーがっっ、、、

・
・
・
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
  See `man xcode-select` for more details.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for mysqlclient

原因究明

長すぎるエラー文に尻もちをついて腰を痛めたが、じっくり下の方を見てみるとどうやらgccに問題があるような気がする。

npm install gcc

してみるもエラー文は変わらず、、。

解決

このコメントを参考にしてみると
anacondaを利用している人はこの処理が必要となるよう。

conda install -c anaconda mysql-connector-python
conda install -c bioconda mysqlclient

できた!!!

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1