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/
% 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 -- mailto:f...@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
to:
http://sourceforge.net/projects/mysql-python/
and downloaded:
MySQL-python-1.2.3.tar.gz
- More info at: 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
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 -- mailto:f...@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-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.