Up

A Simple Way of Using Python

 

A simple way of using Python is as follows:

Write a simple script with a text editor, e.g., Notepad, then save it as a Python script with the filename extension .py (Figure 1).

Figure 1

 

Call a console, e.g. PowerShell, then go to the directory, in which the Python script to run is saved.

Type in Python command with the script file name as follows (Figure 2)

python script-file-name

 

Figure 2

 

The script will be run as shown in Figure 2.

Python can be downloaded from the following website:

https://www.python.org/downloads/

Installation of Python is easy.

After installing Python, you may install packages, which you need, by pip command.

When using pip command, you call a console terminal. For easy installation of packages, you run the terminal as Administrator. To run the terminal as Administrator, click the item name with the right button of the mouse. Choose the item Run as Administrator from the item list displayed (Figure 2).

Figure 2

 

The Windows OS will ask you Do you want to allow this app to make changes to your device?. Click on the Yes button, then you run PowerShell as Administrator to use pip command smoothly.

 

Up