본문 바로가기

ETC/OSX

mac에서 mysqlclient 설치

728x90
반응형

개요

  • pip 에서 mysqlclient 설치하다가 다음과 같이 Error 난다
    • '"'"'/private/var/folders/pc/bd2wkgrd11d11p7bpm8n2rtm0000gn/T/pip-install-0nadjkir/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/pc/bd2wkgrd11d11p7bpm8n2rtm0000gn/T/pip-install-0nadjkir/mysqlclient/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 /private/var/folders/pc/bd2wkgrd11d11p7bpm8n2rtm0000gn/T/pip-pip-egg-info-1dn04d0v cwd: /private/var/folders/pc/bd2wkgrd11d11p7bpm8n2rtm0000gn/T/pip-install-0nadjkir/mysqlclient/ Complete output (15 lines): /bin/sh: mysql_config: command not found /bin/sh: mariadb_config: command not found /bin/sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/pc/bd2wkgrd11d11p7bpm8n2rtm0000gn/T/pip-install-0nadjkir/mysqlclient/setup.py", line 15, in <module> metadata, options = get_config() File "/private/var/folders/pc/bd2wkgrd11d11p7bpm8n2rtm0000gn/T/pip-install-0nadjkir/mysqlclient/setup_posix.py", line 70, in get_config libs = mysql_config("libs") File "/private/var/folders/pc/bd2wkgrd11d11p7bpm8n2rtm0000gn/T/pip-install-0nadjkir/mysqlclient/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.

해결

  • 다음과 같은 순서로 해결함
    • brew install openssl
    • brew install mysql-connector-c
    • 위에서 나오는 환경변수를 적용함
      • $ echo 'export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"' >> ~/.zshrc
      • $ export LDFLAGS="-L/opt/homebrew/opt/mysql-client/lib"
      • $ export CPPFLAGS="-I/opt/homebrew/opt/mysql-client/include"
    • 이후 다시 shell 설정을 다시 적용
      • $ source ~/.zshrc
      • 이후 설치 잘 됨
728x90
반응형

'ETC > OSX' 카테고리의 다른 글

BUILD FAILED (OS X 10.15.7 using python-build 2018042  (0) 2020.11.14
[OS X] Library not loaded  (0) 2020.11.14