I\'ve installed django rest framework using pip install djangorestframework
yet I still get this error when I run \"python3 manage.py sycndb\":
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)
I've faced the same problem, followed these instructions and it worked for me:
python -m pip install --upgrade pip
(to upgrade pip)pip3 install djangorestframework
Added rest_framework
as first app:
INSTALLED_APPS = [
'rest_framework',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#apps
'apps.endpoints',
]
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.
Maybe you install DRF is for python2, not for python3.
You can use python console
to check your module:
import rest_framework
Actually you use pip
to install module, it will install python2 module.
You should install the pip for python3:
sudo apt-get install python3-setuptools
sudo easy_install3 pip
So, you can install python3 module.
INSTALLED_APPS = [
'rest_framework',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#apps
'apps.endpoints',
]
maybe forgot the comma "," or while pasting packing name it might have extra whitespace "packagename "check for that
Yeh for me it was the python version as well ...
much better to use pipenv ...
create a virtual env using using python 3 ...
install pipenv : pip3 install pipenv
create the virtualenv: pipenv --python 3
activate the virtual env: pipenv shell