0

First, I'm following the tutorial on the Django Poll application on their site and have hit a few road blocks.

I've installed Python 2.7 and Django 1.3

Created a new project with

django-admin.py startproject myproject

I got mysql up and running and entered the credentials in settings.py

Then when I try to run

python manage.py syncdb

it puked ... http://pastie.org/2294709

Then when I installed Mysql-python

easy_install mysql-python

Success! ...

Searching for MySQL-python
Best match: MySQL-python 1.2.3
Adding MySQL-python 1.2.3 to easy-install.pth file

Using /Library/Python/2.6/site-packages
Processing dependencies for MySQL-python
Finished processing dependencies for MySQL-python

so I try again

python manage.py syncdb

Still pukes the same message as above

Am I missing Something?

2
  • What do you have for DATABASES in settings.py? Commented Jul 30, 2011 at 15:09
  • Are you using Python 2.6 or Python 2.7? Look at the output you posted. Commented Jul 30, 2011 at 15:16

2 Answers 2

2

jondavidjohn's comment is spot on: you will have no end of confusion with multiple versions of Python on the Mac. There are some things you can do to deal with this.

  1. Stick with 2.6

  2. Convert to Lion, which has 2.7

  3. Add an alias to your shell environment to invoke version 2.7 with $ python. In my bash_profile, I have "alias python='/usr/local/bin/python'"

  4. Be sure to set your PYTHONPATH variable to the site packages directory that corresponds to the version of Python that you're using, such as PYTHONPATH=/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages

  5. Make sure you know which version of easy_install is operative; many module problems arise from assuming that easy_install will use the same site-packages version for everything. Not true always. Every different Python bin directory has its own version of easy_install (or pip, by preference) which will use the corresponding site packages directory.

  6. Don't try to run Django under Python 3.x

  7. Don't try to get rid of the OS version of Python; it will break your installation because software update sometimes relies on it.

  8. Once you're past this hurdle, there are some other parts of getting the sample poll app in Django to run that I had problems with, so I put my experience at https://github.com/technocrat/Writing-your-first-Django-app

Sign up to request clarification or add additional context in comments.

3 Comments

Seems like a hell of a lot of complexity to get to end goal of language simplicity. Thanks!
ok, so what I'm seeing is that I should just stick with the OS version, when I type python into the command line I get 2.7.2, how do I uninstall it now that I've installed it?
@Richard: There is no need to change PYTHONPATH nor create an alias. On OS X 10.6, if you want to use python2.7 as your primary Python, either just type python2.7 or, simpler, ensure that the python2.7 framework bin directory comes first on your SHELL path. If you use the python.org installers for python2.7, by default it will add that to your shell profiles automatically or you can launch /Applications/Python 2.7/Update\ Shell Profile.command to do it for you. Then ensure you install an easy_install for the Python 2.7 and go from there.
0

You need to install and use a version of easy_install for your Python 2.7. You are using the version for the system Python 2.6. Follow the instructions here to install Distribute using python2.7 to launch python. Then use easy_install-2.7 to install mysql-python.

2 Comments

So I guess you can have multiple version of python installed at once? seems like this is going to get very confusing.
Apple ships OS X with multiple versions of Python installed. 10.6 includes Python 2.6.1 and 2.5.4. 10.7 Lion includes 2.7.1, 2.6.6, and 2.5.4. It's really not a problem if you understand what comes first on your PATH and you understand that you need a version of easy_install for each Python.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.