gpt4 book ai didi

python - 模块未找到错误 : No module named 'django.shortcuts'

转载 作者:行者123 更新时间:2023-12-04 17:11:48 25 4
gpt4 key购买 nike

我正在使用 Django 框架创建一个书店网站,在使用 StackOverflow 之前的各种解决方案后仍无法解决此错误。

File "E:\django\bookstore\book\urls.py", line 3, in <module>
from django.contrib.auth import views as auth_views
File "E:\django\env\lib\site-packages\django\contrib\auth\views.py", line 9, in <module>
from django.contrib.auth.decorators import login_required
File "E:\django\env\lib\site-packages\django\contrib\auth\decorators.py", line 7, in <module>
from django.shortcuts import resolve_url
ModuleNotFoundError: No module named 'django.shortcuts'

这是我的views.py

from django.shortcuts import render,redirect
from django.http import HttpResponse
from django.contrib.auth import login,logout,authenticate
from .models import *
from .forms import *

除此之外,我在 env 目录中还有 2 个 venv 配置文件。我应该如何处理它们 - 是否应该删除其中一个?

enter image description here

最佳答案

django.shortcuts 不是 django-shortcuts 包。是这样的:

enter image description here

如果您的django 包不包含它,您可以尝试重新安装django 吗?

enter image description here

enter image description here

enter image description here

关于python - 模块未找到错误 : No module named 'django.shortcuts' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69294838/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com