Click here to Skip to main content
15,887,245 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there a way to run my python script on gnome terminal instead of PyCharm console ? How can i do that ?

What I have tried:

I searched on net but i cant find any useful information
Posted
Updated 1-Mar-17 3:52am

1 solution

Just pass the script name to the python interpreter:
python myscript.py

You can also tell the shell what to do with the script by adding this as first line on top of the script file:
#!/usr/bin/env python

Then make the script executable:
chmod +x myscript.py

Now you can type the script name in the terminal like any other command:
./myscript.py
 
Share this answer
 
Comments
Albert Holguin 1-Mar-17 17:27pm    
+5, I'd add a couple of things... if you're already in python and have a prompt, you can launch via execfile() or exec() (depending on version)... and you can also run the debugger on a python script from the terminal

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900