Dr. Priyanga D. Talagala
IASSL Workshop on Data visualization with R and Python
25/5/2023
Python is pre-installed on many PCs and Macs, making it easily accessible for users.
To check whether you have Python installed on a Windows PC, you can follow these steps
Look for the Python application in the start menu. Simply type 'Python' in the search bar and see if the Python application appears in the results.
Alternatively, you can use the Command Line (cmd.exe) to check for Python. Here's how:
a. Open the Command Prompt by pressing the Windows key + R, typing 'cmd' in the Run dialog, and hitting Enter.
b. In the Command Prompt window, type 'python --version' and press Enter.
c. If Python is installed, you will see the Python version information along with the Python prompt ('>>>').
To check if you have python installed on a Linux or Mac, open the command line or on Mac open the Terminal and type:
Open your preferred web browser and go to the official Python website: https://www.python.org/
On the Python website's homepage, locate the 'Downloads' section and click on it.
You will be directed to the downloads page, where you'll find different versions of Python available for various operating systems. Choose the version that corresponds to your operating system (e.g., Windows, macOS, Linux).
Once you've selected the appropriate version, scroll down and click on the download link associated with it.
The download will start automatically. Depending on your internet speed, it may take a few moments to complete.
After the download is finished, locate the installation file in your downloads folder or wherever you saved it, and double-click on it to begin the installation process.
Follow the installation wizard's instructions to install Python on your computer. You can typically accept the default settings unless you have specific preferences.
Once the installation is complete, you will have Python successfully installed on your computer. Now you can start utilizing the power of Python for your programming needs!"
To quickly test a small amount of Python code, you can use the Python command line interface. Python allows you to run code interactively from the command line.
To access the Python command line interface on Windows, Mac, or Linux, follow these steps:
Open the Command Prompt (cmd.exe on Windows, Terminal on Mac and Linux).
Type 'python' on the command line and press Enter. If the 'python' command doesn't work, you can try 'py' instead.
or
The Python command line interface will start, and you will see a prompt indicating that you can enter Python code:
You can now write and execute any Python code directly. For example, let's use the 'print' function to display 'Hello, World!' on the command line:
After executing the code, you will see the output displayed in the command line:
To exit the Python command line interface, type 'exit()' and press Enter.