I'm having trouble with python manage.py runserver
in mac terminal. That command gives the following error: ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/utils/encoding.py)
.
Trying to resolve that error with from django.utils.encoding import python_2_unicode_compatible
then results in the error of from: can't read /var/mail/django.utils.encoding
. (I did read a solution to use from django.utils.six import python_2_unicode_compatible
instead, however that gives a similar error of from: can't read /var/mail/django.utils.six
.)
There was an article regarding pip that gave advise about debugging and resolving ImportError: cannot import name 'main'
as it is apparently a common error for users who upgraded to pip 10 or higher. However, after following the debugging steps, I couldn't find anything wrong with the path or the version of python (I'm using python 3.7).
Would anyone know what the problem might be? Thanks in advance.
Note - as per the suggestion in the comments section, here is the output of pip freeze:
aioredis==1.3.1
appdirs==1.4.3
asgiref==3.2.7
async-timeout==3.0.1
attrs==19.3.0
autobahn==20.3.1
Automat==20.2.0
certifi==2019.11.28
cffi==1.14.0
channels==2.4.0
channels-redis==2.4.2
constantly==15.1.0
cryptography==2.8
daphne==2.4.1
distlib==0.3.0
Django==3.0.4
django-cors-headers==3.2.1
django-polymorphic==2.1.2
django-rest-auth==0.9.5
djangorestframework==3.9.4
filelock==3.0.12
hiredis==1.0.1
hyperlink==19.0.0
idna==2.9
importlib-metadata==1.5.2
incremental==17.5.0
msgpack==0.6.2
pipenv==2018.11.26
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
PyHamcrest==2.0.2
pyOpenSSL==19.1.0
pytz==2019.3
service-identity==18.1.0
six==1.14.0
sqlparse==0.3.1
Twisted==20.3.0
txaio==20.3.1
virtualenv==20.0.14
virtualenv-clone==0.5.4
zipp==3.1.0
zope.interface==5.0.1