3 Steps to execute python script on BSD’ish Unix systems



To study python programming you should to know how to run python scripts, if you are using windows system, you can read ‘2 steps to run python command line in cmd‘, however, if you are using BSD’ish Unix system, you can do as follow steps.

Step 1: Check python interpreter has been installed on your unix system

Before you start to follow steps, you should make sure python interpreter has been installed, if not, you should install it, because executing python scripts need it. After you have installed, you should find the install path of it.

Step 2: Create a python script with python install path

To run a python script, you should create a test script with python install path, it may like this:


#! /usr/bin/env python3.3

.......

some python code

This file must start with “#!” and there is not any character before  ”#”.

/usr/bin/env is install path of python interpreter, you can find python executable application in this file.

After you created a test python script, such as test.py, you should save it.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>