John H
John H

Reputation: 87

Setting up Django first_project - "ImportError - Did you forget to activate a virtual environment?"

I've been learning the basics of python (first language for me) over the last few months.

I now want to try doing something practical and get into using Django. I'm finding the setup process extremely difficult (thank god for youtube tutorials).

I've installed python, pip, django and virtualenv. EDIT: Have double checked and these are all installed.

I activated my first project: PS C:\Users---\Desktop\first_project> virtualenv first_project Using base prefix 'c:\users\---\anaconda3'

As soon as I try to run the server:

python manage.py runserver

I get the ImportError - "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?".

I'm using Windows 10..any idea what the problem might be?

Thanks in advance.

Upvotes: 0

Views: 2803

Answers (1)

harsha20599
harsha20599

Reputation: 139

I've got the same problem like as you.

If you have installed django by easy_install method in powershell and the django is installed in C:\Program Files\Python36\Lib\site-packages\django-1.11.5-py3.6.egg

I've solved the issue by writing the below line in between import sys and import django in manage.py

sys.path.append("C:\Program Files\Python36\Lib\site-packages\django-1.11.5-py3.6.egg")

or else try executing the following command :

python -m pip install django

Upvotes: -1

Related Questions