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.

asked Apr 2, 2019 at 10:02

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.

answered Apr 2, 2019 at 17:38
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. Commented Apr 3, 2019 at 2:30

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.