apt-get install python-pip
pip install -U pip
apt-get install python-dev libmysqlclient-dev
pip install MySQL-python
MySQLdb is the python support bindings for MySQL. Not that the name would lead you to beleive that.
Its sourceforge page calls it http://sourceforge.net/projects/mysql-python/ which makes more sense.
you need setuptools, which you usually already have:
sudo aptitude install python-setuptools
You need MySQL-devel to compile, but its not called that, its called: libmysql++-dev on Ubuntu
sudo apt-get install libmysql++-dev
download MySQLdb itself from:
http://sourceforge.net/projects/mysql-python/
# the version you download will be more recent
tar xfz MySQL-python-1.2.3.tar.gz
cd MySQL-python-1.2.3
python setup.py build
# the following might fail if it can't find mysql_config on your path
sudo python setup.py install
if it did try locating the mysql_config that was installed with MySQL-devel
and editing site.cfg which is in the MySQL-python folder
uncomment and point to it here:
mysql_config = /usr/bin/mysql_config
and try to build again
if it worked then test:
open a python shell (also change directories out of the compile dir you were just in to avoid confusing yourself with the just compiled version sitting in your path)
import MySQLdb
MySQLdb is the python support bindings for MySQL. Not that the name would lead you to beleive that.
Its sourceforge page calls it http://sourceforge.net/projects/mysql-python/ which makes more sense.
you need setuptools, which you usually already have:
sudo aptitude install python-setuptools
You need MySQL-devel to compile, but its not called that, its called: libmysql++-dev on Ubuntu
sudo apt-get install libmysql++-dev
download MySQLdb itself from:
http://sourceforge.net/projects/mysql-python/
# the version you download will be more recent
tar xfz MySQL-python-1.2.3.tar.gz
cd MySQL-python-1.2.3
python setup.py build
# the following might fail if it can't find mysql_config on your path
sudo python setup.py install
if it did try locating the mysql_config that was installed with MySQL-devel
and editing site.cfg which is in the MySQL-python folder
uncomment and point to it here:
mysql_config = /usr/bin/mysql_config
and try to build again
if it worked then test:
open a python shell (also change directories out of the compile dir you were just in to avoid confusing yourself with the just compiled version sitting in your path)
import MySQLdb
'Computer Science' 카테고리의 다른 글
Structured Testing. (0) | 2013.04.15 |
---|---|
False positive and False negative (0) | 2013.03.05 |