Home > Back-end >  unable to import a library into VS code
unable to import a library into VS code

Time:10-18

I installed pywhatkit, and its stored along with other packages in my python3.8 file. However, I am not able to import it to VS code or any other IDEs. I tried installing tkinter. But I facing the same issue again.What should i do ?

CodePudding user response:

Sometimes VS Code does this. You should install a library, after that just restart VS Code and the problem should be solved. However, if the problem still occurs, it will be due to the Python version.

You are using Python 3, the issue is most likely that when you installed pywhatkit and tkinter you used the pip install library command, which will only install them for Python 2. To install the libraries for Python 3 just use the pip3 install library command in place of pip.

CodePudding user response:

Make sure you have selected the right python interpreter. The Status Bar always shows the current interpreter:

enter image description here

Inspect whether you can find the packages you want to import in this environment.

Inspect where the packages you have installed through pip: pip show xxx.

  • Related