pycharm中未解析的引用django [英] unresolved reference django in pycharm

查看:2055
本文介绍了pycharm中未解析的引用django的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想从django.db导入模型导入

so i'm trying to import

from django.db import models

然后pycharm会强调django.db并抱怨未解决的引用'django'

but then pycharm would underline django.db and complain 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆