トップ
サイト作成料金
お問い合わせ
自己紹介
ブログ
GAC blog.
カテゴリ
gacreate.com
Blog.
pipでmysqlclientインストールするとエラーでる。
0
Python
2023年06月02日06:58
新しくVPS構築して移行させるので、python環境を整えてる。でもエラー対応に時間をとられる😢

CentOS Stream 8 ➔ RockyLinux 9.2

$ pip install mysqlclient
Defaulting to user installation because normal site-packages is not writeable
Collecting mysqlclient
  Using cached mysqlclient-2.1.1.tar.gz (88 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  x exit code: 1
  mq> [16 lines of output]
      /bin/sh: line 1: mysql_config: command not found
      /bin/sh: line 1: mariadb_config: command not found
      /bin/sh: line 1: mysql_config: command not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-2rnsuumu/mysqlclient_d1de1a56619a4f72810d0a5562fcd405/setup.py", line 15, in <module>
          metadata, options = get_config()
        File "/tmp/pip-install-2rnsuumu/mysqlclient_d1de1a56619a4f72810d0a5562fcd405/setup_posix.py", line 70, in get_config
          libs = mysql_config("libs")
        File "/tmp/pip-install-2rnsuumu/mysqlclient_d1de1a56619a4f72810d0a5562fcd405/setup_posix.py", line 31, in mysql_config
          raise OSError("{} not found".format(_mysql_config_path))
      OSError: mysql_config not found
      mysql_config --version
      mariadb_config --version
      mysql_config --libs
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
mq> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

ググりながら色々試したけど解決せず

      /bin/sh: line 1: mysql_config: command not found
      /bin/sh: line 1: mariadb_config: command not found
      /bin/sh: line 1: mysql_config: command not found

コマンドが無いよ言われてるのでyumでそれっぽいlibやdevelが無いか探したけどもない。

1時間ぐらい格闘して、結論mysqlclientはyumで入れる事が分かった。

# yum -y install python-mysqlclient

$ pip list | grep mysql
mysqlclient         2.1.0

🤔CentOSの時はyumで入れたかな~?

記事の内容で気づきや発見、助けられた場合にPayPalで送金(投げ銭)する事もできます。

頂いたお金はサイト運用費に当てさせて頂きます。

コメントを残して頂くだけでもモチベーションアップに繋がります(*^^*)

* 誤字脱字、内容の間違いのご指摘もお願いします
* ネガティブコメントは非表示にする場合がございます
* 独自のスパムチェックを導入してます