How to automatically run a python3 script

This is the place for queries that don't fit in any of the other categories.

How to automatically run a python3 script

Postby linuxdesire » Mon Nov 18, 2013 8:32 pm

I am very new to python and a little new to Linux. I am trying to figure out how I can run a python3 script using my terminal or IDLE. I know that the system uses python 2.7. But I did install python 3 because I am following a beginners book. I see how you can put the # in your script and tell it where the interpreter is. But since mine is not the system installed python how do I do it so it will run my script in Python3 automatically? Thank you.
linuxdesire
 
Posts: 9
Joined: Fri Nov 15, 2013 6:45 pm

Re: How to automatically run a python3 script

Postby hrs » Mon Nov 18, 2013 9:04 pm

Put
Code: Select all
#!/usr/bin/env python3

on the first line of your script.

I don't kwon about IDLE.
hrs
 
Posts: 86
Joined: Thu Feb 07, 2013 9:26 pm

Re: How to automatically run a python3 script

Postby linuxdesire » Mon Nov 18, 2013 9:31 pm

Thank you very much.
linuxdesire
 
Posts: 9
Joined: Fri Nov 15, 2013 6:45 pm


Return to General Coding Help

Who is online

Users browsing this forum: snippsat and 3 guests