解决报错:
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?
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?
在Django中使用迁移命令出现以下错误
# Django输入迁移命令发现以下错误
python manage.py makemigrations
Traceback (most recent call last):
File "/Users/ding/Desktop/meiduo/meiduo_mall/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 "/Users/ding/Desktop/meiduo/meiduo_mall/manage.py", line 22, in <module>
main()
File "/Users/ding/Desktop/meiduo/meiduo_mall/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?
解决办法:
python更换成python3
python3 manage.py makemigrations