Installing Python on Mac/Windows
Day by day, Python is growing and developers are constantly looking into how they can make their websites and web applications better by moving to Python.
If you’re in the same category, or, you are starting to learn Python, this article is for you. In this article, I will explain to you in detail on how to Install Python on your Computer, be it either Mac or Windows.
Now, keep in mind that you should have some basic knowledge on how the terminal/command prompt operates to install python. Although, if you haven’t yet heard or used command prompt or terminal, I’d suggest you to read this Quick Guide to Using Command Line or Terminal.
If you’re in a hurry, then don’t worry. I will explain the steps in this article in such a way that you will be able to install python without the prior knowledge of Command Line or Terminal.
Let’s get started. Choose your operating system below to jump to its section.
Downloading Prerequisite Software
In order to install Python, you first need to download a specific software. The process is the same in both Windows and macOS, however the download files are different for both.
1. Go to the Python Downloads Page.
2. On the Downloads Page, you will see the website will automatically detect on which operating system you are on. If not, you can use the links below the download button to go to your specific operating system’s download page.
3. Here, you will see the Latest Version of Python. Go ahead and click on Download. Alternatively, you can also see the older versions below, you can also download them if you wish to use an older version.
4. The download will start. Let the file get downloaded. It took me 10-15 seconds to download this installation file over Wi-Fi.
Install Python on Windows
The above instructions are general for both macOS and Windows and hence, need to be followed by you irrespective of whichever operating system you are on.
While the Installation Process might be a little different for both the operating systems, they are more or less the same.
Lets Install Python on Windows.
On opening the Installation file which we downloaded earlier, you will see a Dialog Box similar to this.
Click on ‘Install Now’ and proceed ahead. Make sure you check the necessary options on this page as per your requirements.
During this time, you might experience getting a Windows Pop Up Dialog which says “Do you want to allow this app to make changes to your device?”.
Select ‘Yes’ and proceed ahead. Now, the installation will start.
Do note that the Windows Pop Up would be experienced by some, and some people won’t get the pop up. This is normal and nothing to worry about.
Above the progress bar, you will be able to see a label where it shows the current packages being installed. Look out for them, you might come across packages that you’re familiar with!
Once the installation is complete, I want to congratulate you on Python being Successfully Installed on your Windows Computer.
Check Python Version on Windows
You’ve Installed Python on your Windows Computer. Now, it’s time for us to check if you got it right.
Its very simple to check if you’ve got the installation correct. There’s a command to check the current version of Python on Windows. That is what we would use to check if we have correctly installed python on Windows.
Open Command Prompt by going to Start -> Command Prompt and type this command :
If that shows the current version of Python, you’ve got the installation right.
Now, lets move on to macOS.
Install Python on Mac
Alright, we’re done installing on Windows. Now, it’s time to install on Apple macOS operating system. macOS is a very popular operating system among developers and supports almost everything that developers need. So, Python is no exception.
Lets Install Python on Mac.
Once you’ve downloaded the Python Installer on macOS, open it. You should see a Window like this appear.
Click on Continue and select the options that are necessary for you according to your requirements. Now, click on Install to start the Installation process.
Now similar to Windows, you might get a pop up asking for your password which says, “This app wants to make changes” or similar. Enter your password (or Touch ID for some MacBooks) and proceed ahead.
You’re done, very soon you should be able to see a Tick mark Icon which marks the Installation of Python on your Mac computer complete.
Now, as always its time to check if the installation was properly carried out.
Checking Python Version on macOS
To check if the Installation of Python on your Mac Computer was carried out properly, we would need to figure out if your Terminal shows the correct version of Python installed.
Go ahead and launch the Terminal from Launchpad -> Other -> Terminal.
You can also open the terminal by using the Search icon at the top right of your Mac Screen.
Now, type in the following command and check if it shows the current Python Version which you’ve installed.
Boom! That should show you the current version of Python installed on your macOS.
Now, let’s move on to trying out Python for the first time.
Writing Your First Python Program
As an Extra “Pro” Advice, I wanted to share this with you guys because most of you guys would be reading this article as a beginner with Python. So I figured, why not share a simple program to give you a head start?
Hop on to the Terminal again and type this command:
Once you type this and press enter, you will see that the interface changes to Python’s interface. You will be able to see a lot of information about the Python installed on your system and the new line will now change to “>>>”. These arrows mean that you can now start writing Python into the Terminal itself and you will be able to run it too.
Let us write a very simple program.
Type these commands into the Terminal after the “>>>”.
print("Your Name") # Replace Your Name with your name # You should see your name printed # These are comments, do not type these.
That little line of code would print your name on the terminal, for example, “Rishav Kumar”.
Go ahead and put your name and try it out in the terminal, you’d be happy to write your first line in Python.
You can even add in python. For example, try this program to add 5+10 in Python.
# Declaring the Variables and assigning values firstNum = 5 secondNum = 10 # Adding both the Numbers result = firstNum + secondNum # Printing the Results print result
That’s it for this tutorial and guide. I hope you’ve been able to follow all these points and have been successful in doing it.
In this article, you learnt How to Install Python on macOS and Windows operating systems and I gave you a quick look into how you can write your first line of code in Python using the Terminal or Command Prompt.
If you’d like to know more about programming and development, consider subscribing to our Newsletter to stay updated on weekly emails with advanced tutorials and guides.