Setup Menus in Admin Panel

Command Line

Command Line

Python’s Command Line

In this Python documentation you will find all the command line usages for Python. When working in Python we spend a good amount of time working with the command line. Knowing the ins and outs of this tool we allow to work more efficiently.


Run Python Script

To run a Python script we can use a simple command. This command will allow us to any Python file that we have on local computer. This is also referred to as invocation.


Basic Commands

Python’s command line has some basic commands allow use to get help informat or have Python return its current installed version.


Help Commands

python(3) -? or python(3) -h, python(3) –help

The following commands will bring up the command line help information in Python.

We may use python(3) -?,python(3) -h, python(3) –help.


Version Command

python(3) -V or python(3) –version

If you would like to check the current version of Python on your computer you can use the following commands. python(3) -V (V is capitalized), python(3) –version.


More Options


Compare Bytes

python(3) -b

This command will compare to bytes to integers.


Deactivate .PYC Writing Command

python(3) -B

This command will deactivate the .pyc file writing on import of modules


Activate Parser Debugging

python(3) -d

Activate parser debugging output.


Ignore Python Environment Variables

python(3) -E

When activated Python will ignore all Python environment variables.


Enter Interactive Mode

python(3) -i

When either running a Python script or command the -i command will enter the interactive mode.


Run Isolated Mode

python(3) -I

Python will run in isolated mode which Python will not know the containing directories path or know the contents of the site-packages directory.


Optimization

python(3) -O (capitalized)

This command will put Python into optimization mode.


Discard Docstrings

python(3) -OO (capitalized)

This command will put Python into optimization mode but will discard all docstrings.


Don’t Display Copyright and Version

python(3) -q

The -q command will remove the copyright information and version from the interpreter.


Don’t Add Site-Packages Path

python(3) -s

The -s command will not add the site-packages directory to the system path. This will not allow to access installed packages.


Disable Module Site

python(3) -S (capitalized)

The -S command will disable the import of site module.


Display A Message When Module Initialized

python(3) -v

The -v command will display a message every time a Python module is initiated.


Python Environmental Variables

Below you will find some of Python’s environment variables.

PYTHONHOME – This command will change the location of the Python libraries.

PYTHONPATH – Change the search path to the modules files. Formatting this path is the same as the shell.

PYTHONOPTIMIZE – Same as using the -O command listed above.

PYTHONDEBUG – Same as “-d” command which is parsing debug and it is listed above.

PYTHONINSPECT – Same as command -i above.

PYTHONDONTWRITEBYTECODE – This command will not write .pyc or .pyo files when importing source modules. We could also use -B command listed above to invoke this setting.

top
©Master Code Online
X