Unresolved reference: #39;django#39; error in PyCharm(未解决的参考:PyCharm 中的“django错误)
问题描述
我正在尝试导入:
from django.db import models
PyCharm 下划线 django.db 并抱怨:Unresolved reference '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"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:未解决的参考:PyCharm 中的“django"错误
基础教程推荐
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- Discord.py 缺少必需的参数 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
