繁体   English   中英

无法解析 PyPDF2

[英]Could not resolve PyPDF2

当我在 VisualStudioCode 代码编辑器上导入 PyPDF2 并尝试使用 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]

参考诊断严重性规则reportMissingModuleSource表示

没有相应源文件的导入的诊断。 当找到类型存根但未找到模块源文件时会发生这种情况,表明使用此执行环境时代码可能在运行时失败。 类型检查将使用类型存根完成。

简而言之,目前使用的 python 环境中没有这样的模块。

选择 python 解释器后,打开一个新的集成终端,然后运行pip show PyPDF2 如果您获得详细信息并且它的位置是current interpreter\lib\site-packages ,重新加载 window 应该可以解决您的问题。 如果没有,请重新安装它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM