Alex Asked: 2010-06-23 14:56:30 +0800 CST2010-06-23 14:56:30 +0800 CST 2010-06-23 14:56:30 +0800 CST How do I shortcut and not type "python"? 772 RIght now, I type "python myfile.py" to run it. How can I type "py myfile.py" to run it? Or better, do this ./myfile.py? Any tips? linux unix bash shell bin 2 Answers Voted Eric Wendelin 2010-06-23T15:03:35+08:002010-06-23T15:03:35+08:00 You can add this as the first line of your python script: #!/usr/bin/env python Which will allow you to run your script as: ./myfile.py But you must make sure you make your python script executable: chmod +x myfile.py JamesRyan 2010-06-24T01:52:37+08:002010-06-24T01:52:37+08:00 alias py='python'
You can add this as the first line of your python script:
Which will allow you to run your script as:
But you must make sure you make your python script executable: