Download the latest MySQL .DMG distributive from somewhere (i.e. official website) and install it.
sudo pip install python-mysql
It requires superuser privileges to get installed.
What may happen:
while installing mysql-python
Downloading/unpacking mysql-python Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded Running setup.py egg_info for package mysql-python sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 14, in <module> File "/Users/boris/projects/a1/th4x/build/mysql-python/setup.py", line 15, 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 24, 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 14, in <module> File "/Users/boris/projects/a1/th4x/build/mysql-python/setup.py", line 15, 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 24, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found ---------------------------------------- Command python setup.py egg_info failed with error code 1 Storing complete log in /Users/boris/.pip/pip.log
solution:
Add /usr/local/mysql/bin/ to PATHexport PATH=/usr/local/mysql/bin/:$PATH
(from my ~/.bashrc)
trying to run dev server
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x10c59bc90>> Traceback (most recent call last): File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 88, in inner_run self.validate(display_num_errors=True) File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 249, in validate num_errors = get_validation_errors(s, app) File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors for (app_name, error) in get_app_errors().items(): File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 146, in get_app_errors self._populate() File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 64, in _populate self.load_app(app_name) File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 78, in load_app models = import_module('.models', app_name) File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module __import__(name) File "/Users/boris/projects/a1/th4x/tradecontrol/models.py", line 4, in <module> from tradecontrol.db import auto_detect File "/Users/boris/projects/a1/th4x/tradecontrol/db/__init__.py", line 2, in <module> import MySQLdb as mysql File "/Library/Python/2.7/site-packages/MySQLdb/__init__.py", line 19, in <module> import _mysql ImportError: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib Referenced from: /Library/Python/2.7/site-packages/_mysql.so Reason: image not found
solution:
Add to your ~/.bashrc addexport DYLD_LIBRARY_PATH=/usr/local/mysql/lib
and then reread .bashrc. ~/.bashrc