According to the documentation, if Django was installed manually like python setup.py install then the directory needs to be deleted manually.
I found out where Django was installed by running this from Shell
python -c "import sys; sys.path = sys.path[1:]; import django; print(django.__path__)"
and deleted django directory from /usr/local/lib/python2.7/dist-packages/django
Thereafter I tried to install 1.4.1 the automatic way:
sudo pip install Django
Surprisingly it refused to install it:
Requirement already satisfied (use --upgrade to upgrade): Django in /usr/local/lib/python2.7/dist-packages
Cleaning up...
So I had no choice than doing this, even though the documentation hasn’t reflect that.
sudo pip install Django --upgrade
Log:
Downloading/unpacking Django
Downloading Django-1.4.1.tar.gz (7.7Mb): 7.7Mb downloaded
Running setup.py egg_info for package Django
Installing collected packages: Django
Found existing installation: Django 1.4
Uninstalling Django:
Successfully uninstalled Django
Running setup.py install for Django
changing mode of build/scripts-2.7/django-admin.py from 644 to 755
changing mode of /usr/local/bin/django-admin.py to 755
Successfully installed Django
Cleaning up...
It seems the documentation hasn’t mentioned that django files aren’t just in /python2.7/dist-packages/django but also in /usr/local/bin/django-admin.py
I wonder if this is correct the way I have done it, since the documentation explicitely warns:
If you use this installation technique, it is particularly important
that you remove any existing installations of Django first. Otherwise,
you can end up with a broken installation that includes files from
previous versions that have since been removed from Django.
everything ok.
Normaly there’s only a symlink in /usr/local/bin.