Django version always given as 1.11.11 why?

I am trying to get the django version that is installed, I have tried using php and python

if I use linux terminal
$ django-admin --version

using python:

cmd = “pip show django | grep Name” #command to be executed, shell=True)
this returns Name: Django
if I grep version I get
Version: 1.11.11

I tried php and used

$retval = shell_exec( ‘django-admin --version’);
echo $retval
it returns 1.11.11
have now used pip to uninstall 2 versions of Django if I do pip freeze |grep Django I get Django==1.11.11 Now if run pip uninstall Django I get: Not uninstalling django at /usr/lib/python3/dist-packages, outside environment /usr so it seems as though an original version is there and it will not let itself be uninstalled

Are you running this in a virtual environment? Do you perhaps have more than one version of python installed?

You can further explore the issue running which django-admin. That’ll spit out the full path to the django-admin script.

Thanks for replying, I just broke the linux (I deleted the python folder) installation and had to reinstall everything. By the way, a clean installation produced the following folders: Python, Python 2.7, Python 3, Python 5.6. If I run the command python --version from the terminal it says Python 2.7.17. All a bit confusing. I have not yet installed pip so I cannot do a freeze. If you could give me some guidance, it would be appreciated.

chris murray

I like pyenv for managing different versions of python, then using a virtualenv for each project. I can justify it since I have a few packages that I contribute to that need to test 2.7 and 3.5+.

Once you install the correct version of python (be it from or pyenv), create a virtualenv for your project and re-attempt what you did earlier. Though keep in mind, you need to use the virtualenv’s python not the system’s.

Thank you very much for your help.