Follow me as I struggle with rogue technology, insane programmers, and impossible math questions in a battle to the death.

Sunday, October 18, 2009

Install MySQL-python 1.2.3b on mac OS X when you get the

I tried to install MySQL-python on Mac OS X 10.5 and I got the error:

EnvironmentError: mysql_config not found

To fix this error, you need to specify the location of your mysql_config in the site.cfg file.

I found mine in /usr/local/mysql/bin/

In the MySQL-python installation directory, open the site.cfg.

Add a line that says:

mysql_config = /usr/local/mysq/bin/mysql_config

Then run sudo python setup.py install again and it should install correctly.

Labels: ,

Monday, January 05, 2009

Install Jython on Mac OS X 10.5

As someone who has been shackled by the verbose syntax of Java for many years I'm excited by the prospects of using Python on top of Java through Jython.

The installation instructions were simple, but a few steps were missing for a Mac environment (and I assume a GNU/Linux environment).

After installing:

1. Go to jython/bin and run chmod +x jython
2. Go to the base jython directory and run bin/jython once
3. Edit your ~/.profile file and add the absolute path of your jython/bin directory to the path variable (e.g.: export PATH=/opt/local/bin:/Users/jacob/jython2.5b0/bin:$PATH)

My eventual goal is to use Django on top of Apache Tomcat. This goal may require adding a JYTHONPATH variable to my .profile, but I haven't gotten that far yet.

Labels: ,

Friday, December 05, 2008

Compiling python-mysql connector on a Mac

I just received a new Mac Book Pro at work (because my work is super awesome) and I'm trying to install a variety of software. Among this software is MySQL, and the python-mysql connector, so I can use Django with MySQL. I'm finding installing software on a Mac to be rather awkward in general compared to on Windows or Linux. I already tried MacPorts, Fink, and installing from dmg files, and all of them have left a bad taste in my mouth.

With the python-mysql connector specifically, I needed to compile it. Had I not found this page, I probably never would have gotten it working:

How to install Django with MySQL on Mac OS X

One more tip... I tried to use MySQL 64-bit on my Mac Book Pro which was 32-bit, and as a result I had some problems when I tried to make python-mysql talk to MySQL. Be careful about that you use the right version!

Labels: , ,

Friday, February 01, 2008

Django

I installed Python 2.5.1, a pretty painless process other than uninstalling the Cygwin version of Python.

Then I downloaded the MySQLdb package, the Python interface to MySQL. Also painless.

Next I downloaded Django-0.96.1 and ran setup.py install and I got this error:

C:\Django-0.96.1>setup.py install
running install
running build
running build_py
error: package directory '\django' does not exist


People have reported this multiple times to the Django Project, and they don't consider it a bug.

I don't know what else I would call it when an official release has an installation script that doesn't even work. If it was me, I would have file the problem as a deployment bug, added the solution to the bug, and pointed any further questions there.

Regardless, I did downloaded the dev version from svn and copied over MANIFEST.in and setup.py, and the installation worked.

So far I've made it through the first tutorial. The console mode is interesting but I don't know how likely I would be to use that. It seems like a lot of work to learn all those new commands when I already know sql.

The model creation system seems nice, I like how it shows me the actual SQL it's using before it executes the command.

Labels: ,