Reputation: 1
After installing Django version 1.9 in a virtual environment using the following command in Windows:
django-admin --version
I receive a long error, ending with:
File "C:\Users\DELL\env\Lib\site-packages\django\db\models\sql\query.py", line 11, in <module>
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, and the virtual environment was activated.
Django was installed using pip install django==1.9
What should I do to run the command django-admin --version
?
Upvotes: 0
Views: 143
Reputation: 716
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
Upvotes: 0
Reputation: 1
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)
Upvotes: 0