Skip to content
Advertisement

Why is kivy not working in Visual Studio code?

I was writing a piece of code with kivy with all the packages installed.

When I run the code it still shows “No module named kivy”.

The modules were installed from both the command prompt and the VS code terminal though this code had worked fine just a few days ago. Today i opened it and it showed me this error

This is my code

JavaScript

enter image description here

Advertisement

Answer

As people said in the comments, the reason is that the Python environment used by the terminal does not contain modules.

Solution: Please select the Python environment where the module “kivy” is installed in the lower left corner of VS Code, and use the shortcut key Ctrl+Shift+` to open a new VS Code terminal, it will automatically enter the selected environment.

check: We can use the command “pip --version” or “python --version” to check which Python the terminal is using and the module is installed in this location:

enter image description here

Reference: Python environment in VS Code.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement