0

I'm trying to setup MySQLdb to use with python for Scrapy. I'm using the following steps:

Install PIP:

sudo easy_install pip

Edit ~/.profile:

nano ~/.profile

Copy and paste the following two line

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

Save and exit. Afterwords execute the following command

source  ~/.profile

Install MySQLdb

sudo pip install MySQL-python

Once I do the last step I get the following error:

usf-gold-wifi-226-5-42:documents soufin_r$ sudo pip install MySQL-python
Downloading/unpacking MySQL-python
  Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
  Running setup.py (path:/private/tmp/pip_build_root/MySQL-python/setup.py) egg_info for package MySQL-python
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/private/tmp/pip_build_root/MySQL-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    Complete output from command python setup.py egg_info:
    sh: mysql_config: command not found

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/private/tmp/pip_build_root/MySQL-python/setup.py", line 17, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 25, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/MySQL-python
Storing debug log for failure in /Users/soufin_r/Library/Logs/pip.log
usf-gold-wifi-226-5-42:documents soufin_r$ 
FlameDra
  • 1,807
  • 7
  • 30
  • 47

1 Answers1

0
EnvironmentError: mysql_config not found

Install the MySQL client tools and development files first.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358