Python Forum
Python can't import Django and it's in the site-packages directory
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python can't import Django and it's in the site-packages directory
#1
Hello,

I'm trying to play around with the Django tutorial in the Django website, but I ran into an error and don't understand why I am getting it. I found some info about it in other forums, but the answers talk about setting a virtual environment or adding it to the PYTHONPATH environment variable. I still don't understand virtual environments and I'm trying to run this example without it—probably I'll learn and use one soon—and I have django in the following directory "C:\Users\Ivan\Anaconda3\pkgs\python-3.7.0-hea74fb7_0\Lib\site-packages". Isn't this directory supposed to be correct for python to import Django?

This is the exact command I'm using and the exact error I'm getting:

!python manage.py runserver
Output:
Traceback (most recent call last): File "manage.py", line 10, in main from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 16, in main ) from exc 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?
Thanks in advance.
Reply


Messages In This Thread
Python can't import Django and it's in the site-packages directory - by karkas - Feb-09-2020, 05:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot import BeautifulSoup4 as bs4 and BeautifulSoup4 not in same directory B5473829 1 6,420 Jul-05-2019, 06:55 PM
Last Post: snippsat
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 3,311 Jun-30-2019, 12:21 AM
Last Post: scidam
  convert html to pdf in django site shahpy 4 6,036 Aug-17-2018, 11:10 AM
Last Post: Larz60+
  Django packages for website with paid user accounts jmarchini 2 3,536 Jan-08-2018, 09:10 AM
Last Post: SarbjitGrewal
  first django site-ms word/pdf files jon0852 1 4,378 Nov-19-2017, 08:39 PM
Last Post: homayoon_hashemi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020