When I'm setting up a new Mac OS system, the process I go through to
install Python and MySQL.

First, I install Python using this guide:
http://docs.python-guide.org/en/latest/starting/install/osx/
The guide also installs Homebrew, which works great for me so far and is
easily removable.

After Python and Homebrew is installed, then you can install mysql with:

brew install mysql

This will get us the proper headers we need to install MySQLdb with pip.
After MySQL is installed, you can install MySQLdb into a virtualenv or
system-wide with a simple command:

pip install MySQLdb

Hope that helps,

- Chris

On Sun, Sep 23, 2012 at 6:54 PM, Andrew Macgregor <and...@ccg.murdoch.edu.au
> wrote:

> Hi Fred,
>
> I've also found HomeBrew to be useful. Here's a good setup guide:
>
>
> http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/
>
> Cheers, Andrew.
>
>
> On Monday, September 24, 2012 2:02:37 AM UTC+8, Fred Stluka wrote:
>
>>  Resolved this on my own.  Here's what I did:
>>
>> - Downloaded and installed MacPorts, but decided not to use it
>>    because I have too much software already installed that
>>    MacPorts doesn't know about and wants to reinstall (MySQL,
>>    Python, OpenSSL, etc.)
>>
>> - Downloaded and installed Python setuptools and resumed the
>>    MySQLdb setup that I'd already begun (see my previous post
>>    appended below).  It turned out to be easy:
>>    - Download setuptools-0.6c11-py2.7.egg from
>>       
>> http://pypi.python.org/pypi/**setuptools/<http://pypi.python.org/pypi/setuptools/>
>>    % sh setuptools-0.6c11-py2.7.egg
>>    % cd MySQL-python-1.2.3
>>    % python setup.py build
>>    % sudo python setup.py install
>>
>> Success!  Now I can access MySQL from my Python/Django apps.
>>
>> BTW, I also downloaded and installed PyCharm.  Nice Python IDE!
>>
>> --Fred
>> ------------------------------
>> Fred Stluka -- mailt...@bristle.com -- http://bristle.com/~fred/
>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>> Open Source: Without walls and fences, we need no Windows or Gates.
>> ------------------------------
>>
>> On 9/22/12 5:28 PM, Fred Stluka wrote:
>>
>> Django users,
>>
>> What's the latest on the easiest way to access MySQL from Django
>> on Mac OS X 10.6.8 (Snow Leopard)?
>>
>> I've Googled lots of info, but some may be outdated.  Seems to be
>> more complicated than it should be, especially since everything else
>> to do with Django has been so easy.
>>
>> Here's what I've done and learned:
>>
>>   - Followed MYSQLdb link in Django docs:
>>       https://docs.djangoproject.**com/en/1.4/topics/install/#**
>> database-installation<https://docs.djangoproject.com/en/1.4/topics/install/#database-installation>
>>     to:
>>       
>> http://sourceforge.net/**projects/mysql-python/<http://sourceforge.net/projects/mysql-python/>
>>     and downloaded:
>>       MySQL-python-1.2.3.tar.gz
>>   - More info at:  
>> http://mysql-python.**sourceforge.net/<http://mysql-python.sourceforge.net/>
>>   - Confirmed it is not already installed:
>>     % python
>>       Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
>>       [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>>       Type "help", "copyright", "credits" or "license" for more
>> information.
>>       >>> import MySQLdb
>>       Traceback (most recent call last):
>>         File "<stdin>", line 1, in <module>
>>         File "MySQLdb/__init__.py", line 19, in <module>
>>           import _mysql
>>       ImportError: No module named _mysql
>>       >>>
>>   % gunzip MySQL-python-1.2.3.tar.gz
>>   % tar -xvf MySQL-python-1.2.3.tar
>>   % less README
>>     - Lots of caveats.  Has to be built and installed.  Looks ugly.
>>     - Says it requires setuptools Python module.
>>       - Confirmed setuptools is not already installed, by trying the
>> import
>>          statement that setup.py is going to do:
>>         % python
>>           >>> from setuptools import setup, Extension
>>           Traceback (most recent call last):
>>             File "<stdin>", line 1, in <module>
>>           ImportError: No module named setuptools
>>           >>>
>>   % python setup.py build
>>     - Got error, as expected:
>>     Traceback (most recent call last):
>>       File "setup.py", line 5, in <module>
>>         from setuptools import setup, Extension
>>     ImportError: No module named setuptools
>>     Exit 1
>>   % sudo python setup.py install
>>     - No.  Didn't try.  Not yet built.
>>
>>
>> So now I need setuptools first.  Am I starting down a long dependency
>> chain of installs, or will this be easy?
>>
>> I have a Linux server, where it appears that I could use yum to do
>> a painless install:
>>
>>       % yum list all | grep -i mysql | grep -i py
>>         MySQL-python.x86_64     1.2.3-0.3.c1.1.8.amzn1      amzn-main
>>
>> Perhaps there's an easier way for Mac OS X also?  Did some more
>> Googling and found:
>>
>>      http://stackoverflow.com/**questions/1448429/how-to-**
>> install-mysqldb-python-data-**access-library-to-mysql-on-**mac-os-x<http://stackoverflow.com/questions/1448429/how-to-install-mysqldb-python-data-access-library-to-mysql-on-mac-os-x>
>>
>> which is a longish manual set of instructions by an author who wishes
>> there were a better way, but another reply says to just use MacPorts to
>> install it.
>>
>> Any advice?  Thanks!
>>
>>  --Fred
>> ------------------------------
>> Fred Stluka -- mailt...@bristle.com -- http://bristle.com/~fred/
>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>> Open Source: Without walls and fences, we need no Windows or Gates.
>> ------------------------------
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django...@googlegroups.com.
>> To unsubscribe from this group, send email to django-users...@**
>> googlegroups.com.
>>
>> For more options, visit this group at http://groups.google.com/**
>> group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>
>> .
>>
>>   --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/5khu9OJAr1sJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to