If you are discovering or studying Python you may stay in the Interpreter environment to perform all the tasks you want. But, you make one program that has one real function and you want it to be run like any other program in the system, for example in your Linux console, here is how it works.

First, you have to know that Python 2 and 3 are not compatible. So, if you wrote your program in version 2 will not work in version 3, and the opposite is also true.

Knowing that your program was written in version 3, this is the command:

Note: In the first line I issue to list the .py files in the current directory, in the second line are the file. The third line is the command that I performed to run one of the files and the last two lines are actually the program running.

In the case of the program is written in version 2 you can replace the number 3 by 2 or just remove the number because the standard is 2 (this may explain eventual problems while running your programs):

Note: in the example above the command is correctly issued, but the errors from the third line to the end are because the program was actually written in version 3. This is the type of error message you may get even if there is no code error in the program.

Interactive Mode – Instead of exiting when the program is finished it will start an interactive session, very useful for debugging and prototyping.

python -i fileName.py

Using Python Modules [Link] for better productivity:

python -m SimpleHTTPServer 80\

OR

python3 -m http.server 80

Python FTP Server:

sudo apt-get install python3-pyftpdlib
sudo python3 -m pyftpdlib -p 21

PIP, is a package management system used to install and manage software packages written in Python.

sudo apt install python3-pip
pip3 install pyOpenSSL