I've installed django rest framework using pip install djangorestframework
yet I still get this error when I run "python3 manage.py sycndb":
ImportError: No module named 'rest_framework'
I'm using python3, is this my issue?
I've installed django rest framework using pip install djangorestframework
yet I still get this error when I run "python3 manage.py sycndb":
ImportError: No module named 'rest_framework'
I'm using python3, is this my issue?
Also, check for the possibility of a tiny typo:
It's
rest_framework
with an underscore (_
) in between!Took me a while to figure out that I was using a dash instead...
If you are working with PyCharm, I found that restarting the program and closing all prompts after adding 'rest_framework' to my
INSTALLED_APPS
worked for me.if you used pipenv:
if you installed rest_framework thru the new pipenv, you need to run it thru the virtual environment:
1.pipenv shell
2.(env) now, run your command(for example python manage.py runserver)
First installing the framework globally on the system solved my problem.
If you're using some sort of virtual environment do this!
Exit from your virtual environment.
Activate your virtual environment.
After you've done this you can try running your command again and this time it probably won't have any ImportErrors.
In my case, my problem was different. I was creating in my bash_profile an alias like:
And even if I activate my environment, when I ran the command, the python interpreter accessed was from the system and not from my environment.
I just removed the alias from bash_profile and it worked fine.