Tuesday, June 24, 2014

I was installing MySQL-python in Ubuntu, for this I downloaded package file from MySQLdb Download page and proceed as follows:

$ gunzip MySQL-python-1.2.2.tar.gz
$ tar -xvf MySQL-python-1.2.2.tar
$ cd MySQL-python-1.2.2
$ python setup.py build
$ python setup.py install

Note: Make sure you have root privilege to install above module.

When I reached the steps 4 in above process i.e "python setup.py build" I received the following error messages.

sh: 1: mysql_config: not found
Traceback (most recent call last):
  File "setup.py", line 18, in 
    metadata, options = get_config()
  File "/home/user/Downloads/MySQL-python-1.2.4b4/setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "/home/user/Downloads/MySQL-python-1.2.4b4/setup_posix.py", line 25, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

Seems like something is missing in my OS.

As we know MySQLdb is simply a python interface for mysql, but it is not mysql itself and MySQLdb setup process apparently using mysql_config, so you need to install that first, but first confirm whether mysql_config added in system path or not. If it was not added you can do it as follows.

export PATH=$PATH:/usr/local/mysql/bin/

If you do not want add mysql in path, just run something like this to make mysql_config available:

ln -s /usr/local/mysql/bin/mysql_config /usr/bin/mysql_config

Since this is the path that python will search by default. If mysql_config is not already installed you can do it as follows:

apt-get install libmysqlclient-dev


0 comments:

Post a Comment

Categories

.
Powered by Blogger.

Popular Posts

Like Us