Reputation: 183
I'm new to python, when I run this command I'm getting this error
plutus@plutus-probook /var/www/html/python_learn/myproject $ python manage.py startapp webapp
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
import django
ImportError: No module named 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 17, in <module>
"Couldn't import Django. Are you sure it's installed and "
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
If I try to install django, then this is the result
plutus@plutus-probook /var/www/html/python_learn/myproject $ pip install django
Requirement already satisfied: django in /usr/local/lib/python2.7/dist-packages (1.11.6)
Requirement already satisfied: pytz in /usr/local/lib/python2.7/dist-packages (from django) (2017.2)
Upvotes: 0
Views: 487
Reputation: 2173
This could be because you might have multiple versions of python and pip lying around. Try this
python -m pip install django
This will make sure you install django for the same python version which is invoked when you call python on the terminal.
Upvotes: 1