How do import kivy in VS Code?

Viewed 1062

I've installed Kivy.....a lot of times.

I'm in VS Code and it shows in Libraries but I can't seem to figure out how to import.

Getting kivy module does not exist error.

Can run a .py file with just import kivy in the terminal with success.

Cannot run kivy built-in example from terminal. ErrNo2

kivy VS Code library

1 Answers

You're opening python environment as current project. It's not recommended to do so, and we usually open a folder and select the python environment as interpreter.

Turn back to your question, make sure you've selected the opened environment as interpreter. Open Command Palette, click Python: Select intepreter then enter interpreter path. It will pop up a folder explorer, choose your current opened Scripts\python.exe, then you can import kivy successfully:

enter image description here

More information please view Python Tutorial and Python Environments.

Related