How to run the python script in MAC terminal?

Hello All,

i have python script , when i was try to run the script through terminal its not running.

do i need to mention anything in the script. at the beginning of the script.
This is the version of the python i have got on my MAC

Python 2.7.9 (v2.7.9:648dcafa7e5f, Dec 10 2014, 10:10:46)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
vishnu kalakotaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mark brownCommented:
You need python installed on your system. Then you can run this in the terminal in the correct directory:
To run a script type
Gerwin Jansen, EE MVETopic Advisor Commented:
From the above, I see that python in already installed (which is default under MacOS).

Name your script for example and call it like this: python

<edit> double post, did not see the above comment :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
you can add following line as first line in your python script.
#!/usr/bin/env python

Open in new window

if you make the script executable, for example with following shell command
chmod +x

Open in new window

then you can just type

Open in new window

to call it.

I don't know Mac, but probably this shall allow you to even start the script from a file explorer
Gerwin Jansen, EE MVETopic Advisor Commented:
file explorer -> finder
vishnu kalakotaAuthor Commented:
thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.