How to Compile Python With Debugging

Python is a programming language used extensively for Linux and Unix-based applications, such as Red Hat, Debian and Ubuntu. Python is an interpreted programming language, and therefore is not compiled. However, to run a Python script and debug the it, run the “python" command with the source code file name from the command prompt. Make sure Python is installed to your system. Python scripts, as with many other programming language scripts, can be written in a text editor, such as Notepad or Gedit. Create a Python source code script file, then name the script file with ".py” as the file extension.

Things You'll Need

  • Python source code file
  • Python installed
Show More

Instructions

    • 1

      Click the “Application” option on the top navigation bar and then click “Accessories” in Ubuntu. Click the “Terminal” option to open the command line terminal window. If using Ubuntu server or another Linux/Unix based server that does not implement a GUI like Ubuntu, log into the system with “root” privileges and boot the system up to the command prompt.

    • 2

      Type the following command at the prompt and press “Enter” to execute the statement. Replace “myfile” with the name of your Python source code file:

      python myfile.py

      The script runs and errors are listed in the terminal window.

    • 3

      Correct script errors in the source code script file using a text editor and rerun the script file using the same command.

Related Searches:

Comments

Related Ads

Featured