Skip to content Skip to sidebar Skip to footer

Mac Os X + Python + Django + Mysql

I have worked many hours over several days trying to get MySQL working with Mac OS X, Python (I've tried both 2.7 and 3.3), and Django 1.6. This topic is addressed on many webpages

Solution 1:

You could try using the pure-python pymysql:

sudo easy_install pymysql

(Use pip if you have it installed.) Then, add this before execute_from_command_line in manage.py:

try:
    import pymysql
    pymysql.install_as_MySQLdb()
except ImportError:
    pass

Solution 2:

I feel your struggle. I went through the same thing and found the setup process very frustrating. I don't really know which instructions you follow on which website that is throwing exceptions. But I find that all these instructions are missing either one or two small prerequisites. For example, xcode and command-line tools needed to be installed before doing any pip install. For the connectors, if you are using mysql-python, you probably need to install python-devel. I used this instruction. You are probably right that with so many installation attempts your system is probably corrupt and you might need to re-install your osx and start clean, again. It's painful, but that's what I had to do to make it work. I hope your next attempt works.

Post a Comment for "Mac Os X + Python + Django + Mysql"