1

I am developing this python program to run in Raspberry Pi (Raspbian). And my program is using Kivy for UI also. What I need to do now is to make my python script executable and auto boot when startup.

I added this line of code into my first line of python file:

  #!/usr/bin/env python3

However, I realize that if I using command to run the script, it comes out with error, stating there is no module name Kivy. For your info, the line of code is as below:

from kivy.app import App

But, if I double click on the python script, the program can run without any error and function as it is. Does anyone know what can I do to solve this error and make it autorun during boot up?

Your help is very much appreciate.

1 Answer 1

0

You need to install kivy for each of the Python versions you plan to use.

sudo apt install python-kivy  # Python 2
sudo apt install python3-kivy # Python 3

It looks like you have installed kivy for Python 2 but not for Python 3.

Double clicking seems to be running Python 2 whereas running from the command line is honouring the #!/usr/bin/env python3 and running Python 3.

1
  • Hi Joan, thank you very much. I just realize i missed out all the installation of those library that i called after you pointing out my mistake. Thanks and have a nice day.
    – alpha91
    Apr 3, 2019 at 2:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.