Command django-admin --version in windows terminal while using virtual environment displaying error

After installing Django version 1.9 in virtual environment using windows cmd command "django-admin --version" is displaying long error ending with the following:

File "C:\Users\DELL\env\Lib\site-packages\django\db\models\sql\query.py", line 11, in from collections import Counter, Iterator, Mapping, OrderedDict ImportError: cannot import name 'Iterator' from 'collections' (C:\Users\DELL\AppData\Local\Programs\Python\Python311\Lib\collections_init_.py)

Python is installed Virtual environment was activated. Django is installed using pip install django==1.9

What should I do run the command django-admin --version??

Django 1.9 requires Python 2.7, 3.4, or 3.5..make sure you have installed python version from one of these.. (I have copied the answer that I got)

You are using a very old version of Django and, as a result, your Python is incompatible with it. Django is trying to import Iterator from a Python module, but it was moved long ago from collections to collections.abc and that is why it gives you the ImportError.

You can either upgrade you Django to the current version or change your Python to below version 3.3

Back to Top