在运行django项目时( python manage.py runserver),报错:
root@Lisa:/data/github/uploadFiles # python manage.py runserver
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?
但是环境上确实有Django
root@Lisa:/data/github/uploadFiles # django-admin --version
3.0.8
百度上的解决办法千篇一律,有的都是cpoy的别人的解决办法,输入的命令还拼错,完全是在坑人。只能谷歌。
解决办法:
(如果您的计算机中安装了多个python版本。您尝试安装的不同软件包会发生冲突。因此,其中一个解决方法是使用virtualenv)
1.pip install virtualenv
root@Lisa:/data/github/uploadFiles # pip install virtualenv
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/