LoginSignup
0
0

「OSError: mysql_config not found」と言われた時の対処法

Posted at

発生問題

コマンドにpip install mysqclientと入力すると、以下のエラーメッセージが出てきた

・・・
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-pnhw9vzq/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-pnhw9vzq/mysqlclient/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-pnhw9vzq/mysqlclient/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version

開発環境

CentOS7
Python3.9
Django3.2.20

解決策

  • 必要なパッケージをインストール
sudo yum install python3-dev libmysqlclient-dev mysql-community-server

yumリポジトリを追加していない場合は、mysqlをインストールできないので注意してください

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