Django ํ๋ก์ ํธ๋ฅผ ๋ง๋ค๊ณ , ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ฐ๊ฒฐ ๊ตฌ์ฑ์ ์ํด mysqlclient
ํจํค์ง๋ฅผ ์ค์นํ๋ ์ค ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค.
ํ๊ฒฝ
- macOS Mojave 10.14.5
- Python 3.7.3
- pip 19.1.1 (Python 3.7)
๋ฌธ์
ํฐ๋ฏธ๋์์ ์๋ ๋ช
๋ น์ผ๋ก mysqlclient
ํจํค์ง ์ค์น๋ฅผ ์คํํ๋ฉด ์๋ฌ๊ฐ ๋ฐ์ํฉ๋๋ค.
$ pip3 install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/df/8jqrf7b543z2ff2s0rhbq54c0000gn/T/pip-install-v5w8wcwf/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "/private/var/folders/df/8jqrf7b543z2ff2s0rhbq54c0000gn/T/pip-install-v5w8wcwf/mysqlclient/setup_posix.py", line 53, in get_config
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
File "/private/var/folders/df/8jqrf7b543z2ff2s0rhbq54c0000gn/T/pip-install-v5w8wcwf/mysqlclient/setup_posix.py", line 53, in <listcomp>
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
File "/private/var/folders/df/8jqrf7b543z2ff2s0rhbq54c0000gn/T/pip-install-v5w8wcwf/mysqlclient/setup_posix.py", line 12, in dequote
raise Exception("Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id=86971 ?")
Exception: Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id=86971 ?
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/df/8jqrf7b543z2ff2s0rhbq54c0000gn/T/pip-install-v5w8wcwf/mysqlclient/
ํด๊ฒฐ
๋จผ์ mysqlclient
๋ฌธ์๋ฅผ ํ์ธํฉ๋๋ค.
mysqlclient
๋ฌธ์
: mysqlclient - PyPI
ํ์ํ ์์กด ํจํค์ง๋ฅผ ์ค์นํฉ๋๋ค.
$ brew install mysql-connector-c
์์ ์ค์นํ ์์กด ํจํค์ง MySQL Connector/C ์ ๊ธฐ๋ณธ ๊ตฌ์ฑ์ด ๋ถ์ ํํด์ ๋ด์ฉ์ ๋ณ๊ฒฝํด์ผ ํฉ๋๋ค.
mysql_config ๊ตฌ์ฑ์ ์์ ํด์ผ ํฉ๋๋ค.
$ which mysql_config # ํ์ผ์ ์์น๋ฅผ ์ฐพ์ต๋๋ค.
/usr/local/bin/mysql_config
$ sudo nano /usr/local/bin/mysql_config # ํธ์ง๊ธฐ๋ก ํ์ผ์ ์์ ํฉ๋๋ค.
์๋ ๋ด์ฉ์ ์ฐพ์์ ๋ณ๊ฒฝํฉ๋๋ค.
on macOS, on or about line 112:
์๋ณธ:
# Create options
libs="-L$pkglibdir"
libs="$libs -l "
๋ณ๊ฒฝ:
# Create options
libs="-L$pkglibdir"
# libs="$libs -l "
libs="$libs -lmysqlclient -lssl -lcrypto"
SSL ๊ด๋ จ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ฉด ์๋ ๋ช ๋ น์ผ๋ก ์ ๋ณด๋ฅผ ํ์ธํด์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํด์ผ ํฉ๋๋ค.
$ brew info openssl
์ด์ mysqlclient ํจํค์ง๋ฅผ ๋ฌธ์ ์์ด ์ค์นํ ์ ์์ต๋๋ค.
$ pip3 install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... done
Stored in directory: /Users/bbon/Library/Caches/pip/wheels/30/91/e0/2ee952bce05b1247807405c6710c6130e49468a5240ae27134
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.2.post1