-1

May be this question is very basic i googled it but couldn't get a proper answer. I have a python script which when run as "python2.7 mygui.py" in the terminal opens up a gui but now i want to open the gui by double clicking the file icon.

How can it be done ? The python script is written in Pyqt4 and has the shebang line as well.

If it is not possible ? what is another option ? Should i have to install using pyinstaller??

5
  • Which Linux? I can give you the answer for Ubuntu/Nautilus, but that would be a waste of time if you're using something else.
    – AFH
    Sep 25, 2014 at 17:45
  • sry i'm using ubuntu and centos(as well) forgot to mention that @AFH
    – ayaan
    Sep 25, 2014 at 17:46
  • usually all that is required is the correct bang-line. can you confirm that it correctly identifies the runtime required? is python3 installed on your system? Sep 25, 2014 at 17:48
  • @FrankThomas I use python2.7 and i installed it using anaconda
    – ayaan
    Sep 25, 2014 at 17:49
  • I get that your script is designed to use python2.7. my question is, is that the only python runtime installed on your box? Sep 25, 2014 at 20:33

1 Answer 1

0

In Ubuntu's Nautilus file manager, right-click on mygui.py and select Properties. Then click on the Open With tab. From there you can see the default application, but you can move down to any of the other applications and then press Set as default.

If python is not in the list, you can add it by clicking on Add and navigating to the python executable (in my system it's in /usr/bin/python, but you can confirm by typing which python in a bash terminal). But if it's not in the list, python may not have been installed correctly, so consider reinstalling.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .