How to run Python after successfully installing it?
After successfully installing Python, you can run Python code in the following ways:
- Run a Python interactive command line by opening a command prompt or terminal window, entering the “python” command, and then executing Python code by pressing Enter.
- To run a script file: Create a Python script file with the extension .py, such as hello.py, write Python code in the file. After saving the file, open a command prompt or terminal window, use the “python” command followed by the script file’s path, for example “python hello.py”, and press Enter to execute the script file.
- Run in the Integrated Development Environment (IDE): Open the Python script file in an IDE (such as PyCharm, Visual Studio Code, etc.), click the run button, or use a shortcut key to run it.
It is important to note that before running Python code, you need to ensure that Python is correctly installed and added to the system’s environment variables.