[Pythonmac-SIG] Macports and Django install problems
Ned Deily
nad at acm.org
Wed Sep 19 00:52:45 CEST 2007
In article <77FBD535-B3D8-4A23-8D0D-86A39804C152 at innotts.co.uk>,
Dave Everitt <deveritt at innotts.co.uk> wrote:
> After reading about other OS X user's Django install problems, I'm
> attempting to write up the simplest, clearest possible, completely
> unambiguous, instructions for other OS X users here:
> http:ecoconsulting.co.uk/python/django-install.txt
> but obviously I need to get it right first, and...
>
> ...I've hit problems with Macports, detailed below. But I can't find
> anywhere how to install Django from within Python (like Perl's CPAN),
> and Macports is actually suggested on the Django site.
>
>
> -----------------
> The steps I took:
>
> 1.
> Install Python 2.5 from the OS X binary at:
> http://www.python.org/ftp/python/2.5.1/python-2.5.1-macosx.dmg
>
> End up with the following - good so far:
> python -V:Python 2.5.1
> which python:/Library/Frameworks/Python.framework/Versions/Current/
> bin/python
>
> The OS X package appears to have replaced Apple's Python 2.3 with
> 2.5.1 successfully.
Just to be clear, installing 2.5.1 this way does not replace Apple's
2.3, it adds another version, albeit in a different location.
> 2.
> Use Macports to install Django 0.96:
> sudo port install py25-django-devel
>
> Add the Macports path to my .bash_login (and remove .profile):
> export PATH=/opt/local/bin:/opt/local/sbin:$PATH
>
> End up with the following:
> django-admin.py gives: (the expected screen of stuff)
> but
> >>> import django gives: ImportError: No module named django.
>
>
> ------------
> The problem:
>
> While installing Django, the Macports dependency thing also installs
> Python 2.5 under /opt/local/lib/python2.5/
>
> I know OS X needs Python elswhere (and I now appear to have 2
> Pythons) but the running one doesn't have Django in its 'site-
> packages' dir.
>
> Looks like I might have to forget Macports and install Django
> manually under the OS X Python (or copy it across), but will this
> risk being mangled by OS X updates? And is there an easy Python
> 'install django' command?
Actually you now have at least 3 versions of Python installed:
1. the Apple 2.3 version at /System/Library/Frameworks/Python.framework
2. the "official" python.org 2.5.1 version at
/Library/Frameworks/Python.framework
3. the MacPorts 2.5.1 version built by the port command at
/opt/local/lib/python2.5
All 3 can happily co-exist with each other, btw. In all depends on
which version of the python interpreter you start. For example:
/usr/bin/python2.3
/usr/local/bin/python2.5
/opt/local/bin/python2.5
Of course, you need only one of the two 2.5.1's, not both. (Do not try
de-installing the Apple 2.3 one. That is the only one that might be
touched by OS X updates.) I'm feeling a bit lazy to try it all again
from scratch but I'd suggest forgetting about MacPorts for this. For
most users, it should be much simpler to stick to the "official" 2.5.1
version, then getting setuptools installed, and then using easy_install
to install Django and additional site packages needed. I believe you
*should* be able to download and install Django directly with
easy_install with a properly configured setuptools started from the
correct python.
Good luck and thanks for helping to document this better.
--
Ned Deily,
nad at acm.org
More information about the Pythonmac-SIG
mailing list