- Redhat
-
Python3
$ yum install python3-devel mysql-devel # use python34-devel on CentOS 7.3.1611 $ pip install mysqlclient
-
Python2
$ yum install python-devel mysql-devel $ pip install MySQL-python
-
- Ubuntu
-
Python3
$ sudo apt-get update -y && apt-get install -y python3-pip python3-dev build-essential libmysqlclient-dev $ pip3 install mysqlclient
-
-
-
Save hyunjun/4c59ebcbc8d4129afd336700f3bef558 to your computer and use it in GitHub Desktop.
mysql-python
- 문제점; sierra update후 mysql-python connector를 설치할 수 없음
sudo pip install mysql-python
실패- https://pypi.python.org/pypi/MySQL-python/ 에서 zip을 download 받은 후
sudo python setup.py install
실패 - http://wuwenhan.top/diary/fix-problem-that-cannot-install-mysql-via-homebrew-on-macos-sierra/ 이런 link가 있지만 테스트하지 않음
- 다음과 같이 해서 성공했지만, 정확한 순서나 이유등은 모름
-
일단 brew를 update
$ brew update $ sudo chown -R $(whoami) /usr/local $ brew update $ sudo chown root:wheel /usr/local $ brew doctor # 문제 없음 확인 $ brew search mysql # 여러가지 이름에 mysql이 들어간 package list 출력
-
mysql
$ brew cask install mysql-connector-python # 성공 $ python -c "import MySQLdb" # 실패 $ brew install mysql-connector-c # 이미 설치한 mysql 5.7.15때문에 실패 $ brew unlink mysql Unlinking /usr/local/Cellar/mysql/5.7.15... 93 symlinks removed $ brew install mysql-connector-c ==> Downloading https://homebrew.bintray.com/bottles/mysql-connector-c-6.1.6.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring mysql-connector-c-6.1.6.sierra.bottle.tar.gz 🍺 /usr/local/Cellar/mysql-connector-c/6.1.6: 73 files, 16.4M $ sudo pip install mysql-python # 드디어 성공! 하지만 command line mysql 사용 못함 $ brew unlink mysql-connector-c Unlinking /usr/local/Cellar/mysql-connector-c/6.1.6... 45 symlinks removed $ brew link mysql Linking /usr/local/Cellar/mysql/5.7.15... 93 symlinks created $ python -c "import MySQLdb" # 아무 출력 없으므로 정상 동작 $ mysql -h [host] -u [id] -p[pwd] -P [port] [database] -e "SELECT * FROM [table]" # 동작
-
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment