Ubuntu: Getting correct version of the package python-django


I have python-django package installed on Ubuntu 14.04. However the version numbers I get with dpkg -s and django-admin --version does not match.

$ dpkg -s python-django | grep Version  Version: 1.6.1-2ubuntu0.11    $ django-admin --version  1.9    $ lsb_release -d  Description:    Ubuntu 14.04.3 LTS  

I want to understand why that's the case. Because I have another Ubuntu and it also has python-django package on it and version numbers match.

$ dpkg -s python-django | grep Version  Version: 1.7.6-1ubuntu2.3    $ django-admin --version  1.7.6    $ lsb_release -d  Description:    Ubuntu 15.04  

In a nutshell, my question is:

Is is normal to have different outputs for dpkg -s and django-admin --version , which one is the correct version?

And, if it is not normal, how can I fix it?

Edit: output of command -v django-admin on Trusty machine

$ command -v django-admin  /usr/local/bin/django-admin  

Edit: output of /usr/bin/django-admin --version on Trusty machine

$ /usr/bin/django-admin --version  1.9  

Edit: output of apt-cache policy python-django on Trusty machine

$ apt-cache policy python-django  python-django:    Installed: 1.6.1-2ubuntu0.11    Candidate: 1.6.1-2ubuntu0.11    Version table:   *** 1.6.1-2ubuntu0.11 0          500 http://tr.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages          500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages          100 /var/lib/dpkg/status       1.6.1-2 0          500 http://tr.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages  


Yes, it's normal, if you have installed an additional version without the package manager as in your case.

The path /usr/local/bin has a higher priority as the path /usr/bin. For that reason, the command

django-admin --version  

shows another version than

dpkg -s python-django | grep Version  

To force the usage of the version 1.6 you have to use the absolute path

/usr/bin/django-admin --version  

and because I do not know what else you have adapted

sudo apt-get install --reinstall python-django  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »