LoginSignup
0
0

More than 3 years have passed since last update.

mysqlclientをpip installできないときの対処法

Last updated at Posted at 2020-07-07

環境

macOS Catalina 10.15.5
pipenv 2020.6.2
Homebrew 2.4.3

エラー

mysqlclientをインストールしようとすると、長い長いエラーメッセージが出てきてインストールできませんでした。
※ pipenv でインストールしていますが、pipでバージョン指定ナシでも同様の現象があるようでした。
※ Catalinaにアップグレードしたら起こったという情報もありました。

$ pipenv install mysqlclient==1.4.6

...
ERROR: Couldn't install package: mysqlclient

こうしたらいけた

mysql-connector-cをインストール

$ brew install mysql-connector-c

opensslのパッケージ情報を表示

$ brew info openssl

openssl@1.1: stable 1.1.1g (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/openssl@1.1/1.1.1g (8,059 files, 18MB)
  Poured from bottle on 2020-05-03 at 16:19:23
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/openssl@1.1.rb
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> /Users/あなたのホームディレクトリ/.bash_profile

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

==> Analytics
install: 583,299 (30 days), 2,291,367 (90 days), 6,244,922 (365 days)
install-on-request: 72,656 (30 days), 337,989 (90 days), 825,813 (365 days)
build-error: 0 (30 days)

上記コマンドで表示される以下の3つを実行
※ 環境によって異なります.

  $ echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> /Users/あなたのホームディレクトリ/.bash_profile
  $ export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  $ export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

参照

0
0
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
0
0