msinfo32@dEfaaPc2:~/Django/malybar$ python manage.py startapp testApp1
Traceback (most recent call last):
File "manage.py", line 17, in <module>
"Couldn't import Django. Are you sure it's installed and "
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?
我该怎么办?
答案 0 :(得分:0)
答案 1 :(得分:0)
简单的方法是先创建一个虚拟环境并激活它,然后在其环境中创建您的项目和应用。
按照以下步骤进行错误较少的例程:
Python -m venv newms
source newms/bin/activate
pip install django
django-admin startproject projectName
cd projectName
然后 python manage.py startapp appname
在这里,您基本上是在创建名为newms
的虚拟环境并激活它,然后安装django,然后就可以在其中创建您的项目和应用了。