简体   繁体   English

无法解析 PyPDF2

[英]Could not resolve PyPDF2

This error is showing to me when I am importing PyPDF2 on VisualStudioCode code editor and trying to create a GUI using Tkinter this is my first GUI code and I am still learning.当我在 VisualStudioCode 代码编辑器上导入 PyPDF2 并尝试使用 Tkinter 创建 GUI 时,向我显示此错误,这是我的第一个 GUI 代码,我仍在学习。 I am having error in importing PyPDF2.我在导入 PyPDF2 时出错。 The code is-代码是-

                   import tkinter
                   import PyPDF2
                   from PIL import Image, ImageTK
                   
                   root = tkinter.Tk()
                   

It's also showing error in the PIL one and I can't configure them out: The error: '''App.py C:\Users____________________\Downloads 2它还在 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]

With reference to Diagnostic Severity Rules , reportMissingModuleSource means参考诊断严重性规则reportMissingModuleSource表示

Diagnostics for imports that have no corresponding source file.没有相应源文件的导入的诊断。 This happens when a type stub is found, but the module source file was not found, indicating that the code may fail at runtime when using this execution environment.当找到类型存根但未找到模块源文件时会发生这种情况,表明使用此执行环境时代码可能在运行时失败。 Type checking will be done using the type stub.类型检查将使用类型存根完成。

In short, there's no such module in current used python environment.简而言之,目前使用的 python 环境中没有这样的模块。

After selecting python interpreter, open a new integrated Terminal then run pip show PyPDF2 .选择 python 解释器后,打开一个新的集成终端,然后运行pip show PyPDF2 If you get detailed information and its location is current interpreter\lib\site-packages , reload window should solve your question.如果您获得详细信息并且它的位置是current interpreter\lib\site-packages ,重新加载 window 应该可以解决您的问题。 If not, please reinstall it.如果没有,请重新安装它。

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

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