python 에서 mysql 적용을 위해 mysqlclient 설치중 발생하는 에러에 대한 해법 입니다.
해당 환경은 ubuntu 입니다.
에러 발생
# pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.12.tar.gz
Complete output from command python setup.py egg_info:
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-w0qex39c/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-build-w0qex39c/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-build-w0qex39c/mysqlclient/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-w0qex39c/mysqlclient/
추가 패키지 설치
# apt-get install libmysqlclient-dev -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libmysqlclient20 mysql-common zlib1g-dev
The following NEW packages will be installed:
libmysqlclient-dev libmysqlclient20 mysql-common zlib1g-dev
0 upgraded, 4 newly installed, 0 to remove and 4 not upgraded.
Need to get 2148 kB of archives.
After this operation, 12.0 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-common all 5.7.20-0ubuntu0.16.04.1 [15.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libmysqlclient20 amd64 5.7.20-0ubuntu0.16.04.1 [809 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 zlib1g-dev amd64 1:1.2.8.dfsg-2ubuntu4.1 [168 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libmysqlclient-dev amd64 5.7.20-0ubuntu0.16.04.1 [1156 kB]
Fetched 2148 kB in 14s (151 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package mysql-common.
(Reading database ... 13952 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.7.20-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-common (5.7.20-0ubuntu0.16.04.1) ...
Selecting previously unselected package libmysqlclient20:amd64.
Preparing to unpack .../libmysqlclient20_5.7.20-0ubuntu0.16.04.1_amd64.deb ...
Unpacking libmysqlclient20:amd64 (5.7.20-0ubuntu0.16.04.1) ...
Selecting previously unselected package zlib1g-dev:amd64.
Preparing to unpack .../zlib1g-dev_1%3a1.2.8.dfsg-2ubuntu4.1_amd64.deb ...
Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4.1) ...
Selecting previously unselected package libmysqlclient-dev.
Preparing to unpack .../libmysqlclient-dev_5.7.20-0ubuntu0.16.04.1_amd64.deb ...
Unpacking libmysqlclient-dev (5.7.20-0ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Setting up mysql-common (5.7.20-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up libmysqlclient20:amd64 (5.7.20-0ubuntu0.16.04.1) ...
Setting up zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4.1) ...
Setting up libmysqlclient-dev (5.7.20-0ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
해결
# pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.12.tar.gz
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient ... done
Stored in directory: /root/.cache/pip/wheels/df/bb/60/bf7c315cbe163515db1c846e4ffa5557dd785c82e82f3492e8
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.3.12
'Technique' 카테고리의 다른 글
Google Cloud, Docker로 간단하게 웹서비스 구축하기(feat. Django) 2 (0) | 2018.01.17 |
---|---|
Google Cloud, Docker로 간단하게 웹서비스 구축하기(feat. Django) 1 (0) | 2018.01.14 |
Docker를 이용한 Windows에서 Linux 개발환경 구축 (feat, Django) 5 (0) | 2017.11.18 |
Docker를 이용한 Windows에서 Linux 개발환경 구축 (feat, Django) 4 (0) | 2017.11.14 |
Docker를 이용한 Windows에서 Linux 개발환경 구축 (feat, Django) 3 (0) | 2017.11.13 |