I have installed virtual environment via pip install pipenv for my django project in vs code. Although I had successfully installed virtual environment and django(3.0.5) , but when I tried to python manage.py runserver
then it throw me an error. It simply says that it was unable to find any module called django(but when I typed django-admin --version
it shows that I had django installed and it's version is 3.0.5).
In my cmd i got the following message:
C:UsersAhnaaf Al RafeePOLLSTAR_PROJECT>"C:/Users/Ahnaaf Al Rafee/.virtualenvs/POLLSTAR_PROJECT-oW8GrevN/Scripts/activate.bat"
(POLLSTAR_PROJECT) C:UsersAhnaaf Al RafeePOLLSTAR_PROJECT>python manage.py runserver
python: can't open file 'manage.py': [Errno 2] No such file or directory
(POLLSTAR_PROJECT) C:UsersAhnaaf Al RafeePOLLSTAR_PROJECT>cd pollstar
(POLLSTAR_PROJECT) C:UsersAhnaaf Al RafeePOLLSTAR_PROJECTpollstar>python manage.py runserver
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 12, 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?
(POLLSTAR_PROJECT) C:UsersAhnaaf Al RafeePOLLSTAR_PROJECTpollstar>python manage.py runserver 8081
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'
(POLLSTAR_PROJECT) C:UsersAhnaaf Al RafeePOLLSTAR_PROJECTpollstar>django-admin --version
3.0.5
(POLLSTAR_PROJECT) C:UsersAhnaaf Al RafeePOLLSTAR_PROJECTpollstar>python manage.py runserver
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 12, 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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…