嗯,基本上我正在尝试通过这段代码安装 django:
pipenv install django
结果是:[]
然后我有
ERROR: Couldn't install package:...
上千种东西我什至无法在这里展示
我尝试下载新的 python 版本和新的 django 版本,但一直要求 python >=3.7,我不明白为什么
我不知道该怎么办,因为当我停止后端研究数据科学时,我让 django 和 python 出现在角落里,现在我什至不知道发生了什么。我尝试下载 python 3.12 和 Django 5.0 但没有成功
也许因为我刚刚从计算机中删除了一些与 django 相关的文件夹,因为我没有使用它,所以可能会出现问题。当我卸载 django 并再次安装时,我的计算机上已经安装了一些要求,这可能是错误。
检查是否已安装 virtualenv(这是我在项目中使用的)。通过使用 pip install virtualenv 下载它,如果它已安装在您的计算机上,它会告诉您已经满足要求。
如果没有,请按照以下步骤操作:
1. pip install virtualenv
2. virtualenv env (creates the environment folder for your project)
3. If you are on windows, run this command on your CMD or vscode terminal :
env\scripts\activate
4. If you are on Mac, then run this command instead; env/bin/activate,
Then it will automatically make the new env you created display at the left hand-side.
5. Now, install django using pip, and install requirements.txt using pip too.
6. You can now start the project, using this command;
django-admin startproject `myproject` .
Then you can create you Django app modules with :
python manage.py startup `myapp`
And then run the server, and don't forget to freeze the requirements.txt you created via running this command on your terminal below:
pip freeze > requirements.txt
That's it.
Goodluck