The quick answer for MacPorts python:

1) Edit the file /Users/<your username>/.bash_profile. Add the following line 
below the line "export ENV", or to the end of the file if you don't see that 
line:
"export PATH=/opt/local/bin:/opt/local/sbin:$PATH"

2) At the command prompt run "python_select -l" This will show you a list of 
python versions you can select. Pick one, let's say python 2.6, and run 
"python_select python26"

3) Run "which python" and you should get "/opt/local/bin/python". If not, then 
something else is wrong.


The long answer:
There are two potential problems here, both related to MacPorts. 

One, if the directories /opt/local/bin and /opt/local/sbin aren't in the $PATH 
environment variable, then bash (the program that you are using when you're 
working on the command line) doesn't know where to find the macports version of 
python. 

Two, if you don't run "python_select" then your system is still going to run 
the built-in version of python, because macports names the python executable 
pythonXY, where XY is the version (24, 25 or 26).

Both of these issues are caused by MacPorts being very careful not to screw up 
your computer, which is good, but at the cost of a more complicated setup, 
which is confusing for new users.

I hope that helps, and if you'd like more explanation of bash and the details 
of what's going on with the $PATH variable, then I suggest checking out this 
"Bash by example" series of articles. 

http://www.ibm.com/developerworks/library/l-bash.html


On May 10, 2010, at 10:24 AM, HelloWorld wrote:

> So for future users who have the same problem.
> 
> I uninstalled the macports version of django with this:
> 
> sudo port -f uninstall <port>
> 
> and then reinstalled with easy setup which automatically puts the
> django package in the correct place.
> 
> Now everything worked as described in the tutorial.
> 
> Could be worthwhile for macports or anybody who used macports, to post
> the correct way to install with macports and What the benefit is to
> use macports over django.
> 
> Best
> 
> Z.
> 
> 
> 
> On May 10, 1:13 pm, HelloWorld <[email protected]> wrote:
>> Thanks a lot backdoc!!
>> 
>> I found the site packages you mentioned, but neither Python 2.5 nor
>> 2.6 have any django in it.
>> I know that on the commandline it is running version 2.5 and django is
>> freshly installed and so could need 2.6.
>> How could I install it there?
>> 
>> I start to think the Macports installation is the problem.
>> Is there any way to uninstall everything and reinstall with easy setup
>> from django?
>> As I read this is the prerequisite to install a new version.
>> 
>> What wonders me is that it did everything else, create the manage,
>> _init__ , settings, urls.py
>> Do I miss something really obvious?
>> 
>> And as a matter of fact I am starting to understand python and django,
>> so please excuse any newbie errors.
>> 
>> Thanks a again for the help
>> 
>> Best
>> 
>> Z.
>> 
>> On May 6, 11:53 pm, backdoc <[email protected]> wrote:
>> 
>> 
>> 
>>> Type "which python" at the command line as your regular user.  Then, look at
>>> /usr/bin/python*, /usr/lib,  /usr/local/bin/python* and /usr/local/lib.
>>>  Find where the site-packages for Django are located.  Make sure that "which
>>> python" is pointing to the correct version.
>> 
>>> Sounds like Django is not installed in the same version of Python that you
>>> are actually using.  Also, if you type python -V (I think it's a capital
>>> "V") at the command line, it should tell you which version you are using.
>> 
>>> On Thu, May 6, 2010 at 3:47 AM, HelloWorld <[email protected]> wrote:
>>>> Hi everybody
>> 
>>>> I just got Django installed (to test it) via Macports and I have
>>>> Python 2.5 and 2.6 installed on a MacBook running 10.6.3.
>> 
>>>> I did everything the installation guide told me, but after typing:
>> 
>>>> python manage.py runserver
>> 
>>>> I get this error:
>> 
>>>> File "manage.py", line 2, in <module>
>>>>    from django.core.management import execute_manager
>>>> ImportError: No module named django.core.management
>> 
>>>> I believe the solution would be this comment on the installation
>>>> site:
>> 
>>>> To avoid a command not found issue with Snow Leopard 10.6.2 and
>>>> various other OSX (Django installed using MacPorts?) here a tip that
>>>> might help. There might be a $PATH issue. Adding the proper PATH to
>>>> ~/.Profile: export PATH=/opt/local/bin:opt/local/sbin:/opt/local/lib/
>>>> python2.4/site-packages/django/bin:$PATH should help. NB Could be that
>>>> one needs to change the Python version in the PATH.
>> 
>>>> But I dont now what a $PATH issue is and where I could paste this code
>>>> to fix it.
>> 
>>>> Or if you know another possible reason please tell me.
>> 
>>>> Any help would be greatly appreciated.
>> 
>>>> Thanks a lot
>> 
>>>> Best
>> 
>>>> Z.
>> 
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "Django users" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected]<django-users%[email protected]>
>>>> .
>>>> 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 [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected].
>>> For more options, visit this group 
>>> athttp://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 [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group 
>> athttp://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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to