How to Run a Python Script in IPython

IPython is an interactive version of the Python scripting engine, and iPython is an open source application available from ipython.org. You can run a Python script, or a series of scripts, using iPython from the Windows or Unix/Linux command line. A Python script is a simple text file containing Python commands, and ending with a “.py” file extension. Run a Python script by invoking the iPython engine from a command line statement.

Things You'll Need

  • iPython installed
Show More

Instructions

    • 1

      Log in with “root” or Administrator rights and boot up to the command prompt. In Windows, click the “Start” button, and then type “cmd” (without quotes) into the Search input box. Press the “Enter” key. The DOS window opens.

    • 2

      Type the following command to start interactive Python (iPython):

      ipython

      The iPython application starts and displays a welcome message. The “In [1]:” prompt appears.

    • 3

      Type the following command at the prompt where “file" is the name of your file, and then press the “Enter” key to execute the command:

      run file.py

      The Python script named “file.py” is executed and run in iPython.

Related Searches:

Comments

Related Ads

Featured