当我在PyPDF2代码编辑器上导入VisualStudioCode并试图使用Tkinter创建GUI时,这个错误正在向我展示--这是我的第一个GUI代码,我还在学习。我在导入PyPDF2时出错了。密码是-
import tkinter
import PyPDF2
from PIL import Image, ImageTK
root = tkinter.Tk()它还显示了PIL中的错误,我无法将它们配置出来:错误:‘’App.py C:\Users____________________\Downloads 2
import "PyPDF2 could not be resolved
Pylance(reportMissingImports) [3,8]
⚠ Import could not be resolved from source
Pylance(reportMissingModuleSource) [4,6]发布于 2021-12-28 07:20:36
就诊断严重度规则而言,reportMissingModuleSource意味着
没有对应源文件的导入的诊断信息。当找到类型存根时会发生这种情况,但是没有找到模块源文件,这表明当使用此执行环境时,代码可能在运行时失败。类型检查将使用类型存根完成。
简而言之,在当前使用的python环境中没有这样的模块。
选择python解释器后,打开新集成的终端,然后运行pip show PyPDF2。如果你得到了详细的信息,并且它的位置是current interpreter\lib\site-packages,重新加载窗口应该可以解决你的问题。如果没有,请重新安装它。
https://stackoverflow.com/questions/70493239
复制相似问题