简体   繁体   中英

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. I am having error in importing 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


                    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

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.

After selecting python interpreter, open a new integrated Terminal then run pip show PyPDF2 . If you get detailed information and its location is current interpreter\lib\site-packages , reload window should solve your question. If not, please reinstall it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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