pip install mysqlclient 명령어를 입력하여 mysqlclient를 설치하고 하니 다음과 같은 에러가 발생하였다.
❯ pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.0.3.tar.gz (88 kB)
ERROR: Command errored out with exit status 1:
command: /home/song/miniconda3/envs/westarbucks/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-oc1xpiyw/mysqlclient_5065485605a44b02905d19b84f655f73/setup.py'"'"'; __file__='"'"'/tmp/pip-install-oc1xpiyw/mysqlclient_5065485605a44b02905d19b84f655f73/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-xra4p4nm
cwd: /tmp/pip-install-oc1xpiyw/mysqlclient_5065485605a44b02905d19b84f655f73/
Complete output (15 lines):
/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-oc1xpiyw/mysqlclient_5065485605a44b02905d19b84f655f73/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-oc1xpiyw/mysqlclient_5065485605a44b02905d19b84f655f73/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-oc1xpiyw/mysqlclient_5065485605a44b02905d19b84f655f73/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
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
일단 에러부터 확인해보자.
종료 상태 1로 명령 오류가 발생하였다고 한다.. 무슨뜻이지 ?
일단은 구글링!
구글링 하니 다음과 같이 입력하라고 나온다.
conda를 이용하고 있으면 conda명령어를 사용하여 다운로드 받아보라고 한다.
conda install -c quantopian mysqlclient
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/song/miniconda3/envs/westarbucks
added / updated specs:
- mysqlclient
The following packages will be downloaded:
package | build
---------------------------|-----------------
mysql-connector-c-6.1.11 | h597af5e_1 1.2 MB
mysqlclient-2.0.3 | py38h2531618_1 78 KB
------------------------------------------------------------
Total: 1.3 MB
The following NEW packages will be INSTALLED:
mysql-connector-c pkgs/main/linux-64::mysql-connector-c-6.1.11-h597af5e_1
mysqlclient pkgs/main/linux-64::mysqlclient-2.0.3-py38h2531618_1
Proceed ([y]/n)? y
Downloading and Extracting Packages
mysqlclient-2.0.3 | 78 KB | ############################################################ | 100%
mysql-connector-c-6. | 1.2 MB | ############################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
설치가 잘된다.
재대로 설치가 되었는지 확인해보자.
❯ pip freeze
asgiref==3.3.1
certifi==2020.12.5
Django==3.1.5
mysqlclient @ file:///tmp/build/80754af9/mysqlclient_1609786257049/work
pytz==2020.5
sqlparse==0.4.1
잘 설치가 되었다.
일단은 임시방편으로 conda명령어를 사용하여 다운받았지만 ...
다음엔 문제를 해결해서 다운받아야겠다.
추가내용
https://arslan-0909.tistory.com/m/4?category=772152
위 와 같은 방법도 있다고 하니 나중에 해보자