python - 导入“embed_video.fields”无法解析 Pylance 报告缺少导入
问题描述
我正在做这个项目,我正在使用 VS-code 编辑器。我已经使用 pip install 安装了 Django-embed-video,并且在 INSTALLED_APPS 下的设置中安装了 embed_video。这是 embed_video 在我的电脑上安装的目录:
C:\Users\DEL.L\AppData\Local\Programs\Python\Python39\Lib\site-packages
.
但是当我尝试导入“embed_video.fields
我收到错误消息说” could not be resolved Pylance report Missing Imports
“。
from django.db import models
from embed_video.fields import EmbedVideoField
# Create your models here.
class video(models.Model):
title = models.CharField(max_length=100)
added = models.DateTimeField(auto_now_add=True)
url = EmbedVideoField()
def __str__(self):
return str(self.title)
class Meta:
ordering = ['-added']
解决方案
请在VS Code终端使用命令“ pip --version
”查看模块安装工具“pip”的来源,模块安装在这里:
然后使用“ pip show django-embed-video
”查看模块已经安装成功:
另外,请在模块安装完成后尝试重新加载 VS Code。
推荐阅读
- python - 将已经是字典格式的列表变成字典
- python - 运行 Python 多进程时性能逐渐下降
- powershell - LogonWorkstations 不为空且已填充的位置
- vim - 确保文本块中的所有缩进在 vim 中都相同
- php - 用 PHP 发送 Protonmail / PGP 电子邮件
- html - 我的 CSS 代码是否没有为媒体查询正确设置?
- math - math.random() 只返回 1?
- lda - 太多的值需要解压(预期为 2) lda
- profiling - Miniprofiler (Asp.net Core) 使用 sessionStorage 进行基本身份验证
- reactjs - 仅区分节点应用程序的单一类型更改?