N
N
Nikita Juzz2022-04-11 21:13:11
Django
Nikita Juzz, 2022-04-11 21:13:11

Why is there a Django module import error?

Installed the virtual environment, installed django, when writing the django-admin --version command, the required version is shown
62546c96c59d0784949933.jpeg

When I try to start the local server, it gives out
62546d0fa51de641556069.jpeg

Tried:
1) Deleting the virtual environment and restarting and then installing django
2) Tried to make 2 types of virtual environment:
Thus

python3 -m virtualenv demoEnv

And thus
python3 -m venv tutorial-env

And still, every time it gives out
(demoEnv) PS E:\frontendprog\projeckt2\my_django_project> python3 manage.py runserver
Traceback (most recent call last):
File "E:\frontendprog\projeckt2\my_django_project\manage.py", line 11, 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 "E:\frontendprog\projeckt2\my_django_project\manage.py", line 22, in
main()
File "E:\frontendprog\projeckt2\my_django_project\manage.py", line 13, in main
raise 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?


Although it sees Django, it gives an error on this command.

when creating a dependency file with the command
pip freeze > requirements.txt
creates the following dependencies
asgiref==3.5.0
Django==4.0.4
Pillow==9.1.0
sorl-thumbnail==12.8.0
sqlparse==0.4.2
tzdata==2022.1

, and Django is among them

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BEKa T, 2022-04-11
@Nikita0802

you downloaded django via pip (it turns out 2), and you run version 3 with python.
Try installing django with pip3 or start a serverpython manage.py runserver

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question