Search code examples
pythonwindowsmobilekivykivy-language

kivy.app is not working because my computer can't find it


I am trying to use Kivy but it keeps saying there is no module called "kivy.app", "Kivy" is not a package even tho I downloaded it(I downloaded it from VS code command prompt).My problem

I tried defining it on the path and adding it to the same disk, but I don't know how to solve it because a lacks guidelines for Kivy.The path to kivy


Solution

  • try using a Python virtual environment to develop and distribute your Kivy application, it's more reliable and should solve your problem.

    1. create a Python virtual environment (go to the directory where you want to create it and open it in the terminal):

      python -m venv venv

    2. activate the virtual environment (so that the terminal uses the venv's Python exe and not the machine's)

      venv/Scripts/activate

    3. if the above command doesn't work, powershell script execution is disabled on your machine. to solve the problem, use the command : Set-ExecutionPolicy RemoteSigned then retry the command of the second step.

    4. once the venv is active, install Kivy:

      pip install kivy

    5. run your Kivy applications with this venv python main.py (for example) but the venv must be enabled to run main.py with this command. otherwise use venv/Scripts/python.exe main.py .

    I hope I've helped you.