0

Long story short - I am writing Selenium webdriver Python tests that need to access an external server's MySQL database. I tried installing mysqldb using sudo easy_install MYSQL-python, but I got this message:

EnvironmentError: mysql_config not found` (full (long) traceback below).

I am kind of new to a Python, so I don't fully understand this, but is it saying that I need to have MySQL installed on my local machine? If so, how would I do that, and since I don't need it, is there another way you can recommend? Also, I am running a Mac with Mac OS X Mavericks (10.9).

Traceback (most recent call last):
File "/usr/bin/easy_install-2.7", line 10, in <module>
    load_entry_point('setuptools==0.6c12dev-r88846', 'console_scripts', 'easy_install')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 1712, in main
    with_ei_usage(lambda:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 1700, in with_ei_usage
    return f()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 1716, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 211, in run
    self.easy_install(spec, not self.no_deps)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 446, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 476, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 655, in install_eggs
    return self.build_and_install(setup_script, setup_base)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 930, in build_and_install
    self.run_setup(setup_script, setup_base, args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 919, in run_setup
    run_setup(setup_script, args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 62, in run_setup
    lambda: execfile(
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 105, in run
    return func()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 64, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
File "setup.py", line 18, in <module>
File "/tmp/easy_install-Lk4VVX/MySQL-python-1.2.4/setup_posix.py", line 43, in get_config
File "/tmp/easy_install-Lk4VVX/MySQL-python-1.2.4/setup_posix.py", line 25, in mysql_config
EnvironmentError: mysql_config not found
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
kroe761
  • 3,296
  • 9
  • 52
  • 81

1 Answers1

0

The error message that you're facing is due to the lack of headers on your machine. That is, you're missing some libraries.

If you're on a Debian-based Linux OS, I'd suggest you use the package provided through aptitude:

sudo apt-get install python-mysqldb

On a side note, drop easy install and start using pip.

sudo apt-get install python-pip

If you want to install this module only with pip/another Python dependency manager you'll need to have several tools/libraries installed on your machine in order to build it:

sudo apt-get install python-dev libmysqlclient-dev
sudo pip install MySQL-python
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ketouem
  • 3,820
  • 1
  • 19
  • 29
  • Thanks very much for the info, but I'm actually using a Mac. I have added this to the original post. Do you know how I would proceed on a Mac? Thanks! – kroe761 Dec 16 '13 at 21:33
  • Hum I'm not pretty familiar with such procedures on Mac OS. But geiven what I've read on the Internet you'll have to build from sources. Here are some references: http://www.markomedia.com.au/installing-python-mysqldb-on-os-x/ http://stackoverflow.com/questions/16182294/installing-mysql-python-on-mac-osx – Ketouem Dec 17 '13 at 11:58