当我激活虚拟环境并输入python manage.py 运行服务器它给了我以下错误:
(myenv) nouman@nouman-G3:~/Documents/test/myshop$ 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?
我甚至尝试使用 'python3' 但仍然不起作用
答案1
好的,我通过删除我的虚拟环境文件夹以及我正在使用的所有库和第三方应用程序解决了这个问题,然后我创建了新的虚拟环境并再次从我的 requirements.txt 文件中安装了所有内容