가끔 새로운 환경에서 MySQL
관련 파이썬 패키지를 다운받을 때 mysqlclient
가져올 때 쯤에 아래와 같은 에러가 발생한다.
Collecting mysqlclient==2.1.1 (from -r requirements.txt (line 38))
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.
│ exit code: 1
╰─> [16 lines of output]
/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 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-sw157215/mysqlclient_fd944a723fc44e0c9e1fdc35db404cb3/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-sw157215/mysqlclient_fd944a723fc44e0c9e1fdc35db404cb3/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-sw157215/mysqlclient_fd944a723fc44e0c9e1fdc35db404cb3/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.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
찾아보니 해당 패키지 빌드를 위한 파이썬 패키지가 없어서 생긴 오류인듯 하다 !
아래 명령어를 통해 관련 패키지 설치 후, 다시 mysqlclient를 설치하면 된다.
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential