未解决的参考:PyCharm中的“ django”错误 [英] Unresolved reference: 'django' error in PyCharm
问题描述
我正在尝试导入:
from django.db import models
PyCharm强调 django.db
并抱怨:未解决的参考'django '
。
PyCharm underlines django.db
and complains: Unresolved reference 'django'
.
如何让PyCharm识别Django?
How do I get PyCharm to recognize Django?
推荐答案
我假设您使用的virtualenv与其他项目文件位于同一目录中。 Python应该确切知道该路径。因此,Pycharm可能使用了错误的解释器。
I assume you're using a virtualenv which is located in the same directory as other project files. Python should know exactly that path. So, it's possibly that Pycharm is using the wrong Interpreter.
转到设置->项目:->项目解释器->切换到正确的路径
Go to Settings -> Project: -> Project Interpreter -> switch to the right path
在解释程序包中,应该安装了Django包。如果没有,请在此处/在终端中执行。
In the interpreter packages, there should be Django package installed. If not, do it here/in terminal.
这篇关于未解决的参考:PyCharm中的“ django”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!