- Download Python 3.6 For Mac
- Download Python 3 For Mac
- Download Python 3.7 3 For Mac
- Download Pandas For Python 3 Mac
- Download Python 3 For Mac
Historically MacOS came preinstalled with Python 2, however starting with Mac 10.15 (released in October 2019) this is no longer the case. And since Python 2 will no longer be officially supported as of January 1, 2020, you should really use Python 3 instead.
There are multiple ways to install Python 3 on a MacOS computer. The official Python website even recommends downloading it directly, however this approach can cause confusion around PATH variables, updates, and uninstalls. A better approach, in my opinion, is to instead use the popular package manager Homebrew which automates updates and juggling multiple versions of Python on a computer.
Is Python 3 already installed?
Before we start, make sure Python 3 isn’t already installed on your computer. Open up the command line via the Terminal application which is located at
Applications -> Utilities -> Terminal.
Then type the command
python --version followed by the Enter key to see the currently installed version of Python.
Note: The dollar sign, (
$), indicates user input. Everything after is intended to be typed by the user followed by the Enter key. Any output, such as
Python 2.7.17 in this case, does not have a dollar sign in front.In short: don’t type
$ before your commands!
It’s possible that Python 3 may have already been installed as
python3. Run the command
python3 --version to check, however most likely this will throw an error.
The first step for Python 3 is to install Apple’s Xcode program which is necessary for iOS development as well as most programming tasks. We will use XCode to install Homebrew.
In your Terminal app, run the following command to install XCode and its command-line tools:
It is a large program so this make take a while to download. Make sure to click through all the confirmation prompts XCode requires.
Next install Homebrew by copy/pasting the following command into Terminal and then type Enter:
To confirm Homebrew installed correctly, run this command:
Install Python 3
Now we can install the latest version of Python 3. Type the following command into Terminal and press Enter:
To confirm which version of Python 3 was installed, run the following command in Terminal:
Finally, to run our new version of Python 3 open an interactive shall by typing
python3 within Terminal:
To exit the Python 3 interactive shell, you can type either
exit() and then Return or type
Control+d which means hold both the Control and D keys at the same time.
Note that it is still possible to run Python 2 by simply typing
By default, Python packages are installed globally on your computer in a single directory. This can cause major problems when working on multiple Python projects!
For example, imagine you have Project A that relies upon Django 1.11 whereas Project B uses Django 2.2. If you naively installed Django on your computer, only the latest install would be present and available in that single directory. Then consider that most Python projects rely on multiple packages that each have their own version numbers. There’s simply no way to keep everything straight and not inadvertently break things with the wrong package versions.
The solution is to use a virtual environment for each project, an isolated directory, rather than installing Python packages globally.
Confusingly, there are multiple tools for virtual environments in Python:
- venv is available by default on Python 3.3+
- virtualenv must be installed separately but supports Python 2.7+ and Python 3.3+
- Pipenv is a higher-level tool that automatically manages a separate virtual environment for each project
On MacOS we can install Pipenv with Homebrew.
Then use Pipenv for any Python packages you wish to install. For example, if you want to work with Django 2.2.6, first create a dedicated directory for it on your computer such as in a
django directory on your Desktop.
Then install Django within that directory.
If you look within the directory there are now two new files,
Pipfile.lock, which Pipenv uses. To activate the virtual environment type
There will now be parentheses around the name of your current directory which indicates the virtual environment is activate. To exit the virtual environment, type
The lack of parentheses confirms the virtual environment is no longer active.
To learn more about Python, the books Python Crash Course and Automate the Boring Stuff are great resources. For free tutorials on web development with Python check out Learn Django.
Being a software engineer, you often come across many instances where you would require to have Python installed on your Mac.
However, the issue is most modern macOS versions come with rather with Python 2.7.x installed and not the newer, modern version like Python 3.6.5 or Python 3.7.2 (which is the most up-to-date version right now).
This short guide is written to show you how to properly install Python 3 on a Mac OS Xcomputer.
Before you jump into the guide, do take note that there are multiple ways to install Python 3 on a Mac but with this guide, I’ll show you the two easiest ways to do this, step-by-step.
Personally, the way I did it was using a package manager like HomeBrew (it’s okay if you don’t understand what it is). Again, I’ll show you how to do this method down below.
Wait, how do I check if Python 3 is already installed on my Mac?
Simple. Open up your Terminal and type the following line
python --version and then hit your Enter key:
You should see the python version that is currently installed on your Mac.
How to Install Python 3 on macOS: 2 Ways
1. The Simplest Way.
Perhaps the simplest way to install Python 3 on macOS.
This is for you especially if you’re a newbie (though I still strongly recommend you try the HomeBrew method below) or if you don’t want to deal with copy-pasting code into your Terminal and downloading other software.
Here’s how to install Python 3 on your macOS:
- Jump into Python.org downloads page and simply just download the latest Python version.
- Next, run the Python Installer to install Python 3 onto your Mac.
The Python installation may require about 100MB of disk space to install. Once you’ve installed Python 3 you can have it alongside Python 2 without having to delete the latter from your Mac.
- Great! Now once Python 3 is installed, you’ll be able to find it within the Applications directory of your Mac. You’ll also find here a simple IDE called “IDLE.app” which gives you a basic Python IDE.
Help! Where do I find the Applications directory?
If you can’t find the Applications directory, simply go to Finder by clicking the Finder icon in the Dock (it’s usually the first icon from the left side of the Dock). From there simply, go to the Go menu and select Applications.
Done. If you got yourself lost through the process, you can comment down below.
Next up, I’ll show you how you can install Python 3 using HomeBrew onto your macOS. This is my preferred way and it is just as simple as the method before but it will make your life a whole lot simpler, in the long run, using Python.
2. Install Python 3 on Mac using HomeBrew.
This method is dead-ass simple and a little fun. 🙂
Download Python 3.6 For Mac
First of all, you’ll need to have this thing called HomeBrew installed on your Mac. Homebrew is basically a “package manager”. A package manager is an application that helps you install the stuff you need that Apple (or even your Linux System) hadn’t installed in the first place for you.
Download Python 3 For Mac
It’s simple, fast and safe.
Second, you will need to have installed XCode onto your Mac. If you’re thinking of learning how to program or creating iOS apps on your Mac, then it’s good to have XCode installed. We will be using XCode to install HomeBrew application.
If you have already installed XCode onto your Mac you can skip step 1 and jump straight to step 3.
Here are the steps to install XCode, HomeBrew as well as install Python 3 using HomeBrew onto your Mac:
- Jump into your Terminal app on your Mac and run the copy/paste the following command into the Terminal to install XCode onto your Mac:
- Simply click through all the confirmation crap that XCode shows. It may take a little while to install XCode since it is a large program.
- Great! Now that you have XCode installed, you can install HomeBrew! To install HomeBrew, simply copy/paste the following command into your Terminal:
You can confirm the HomeBrew installed correctly by running the command: below:
- You’ve installed HomeBrew! Now let’s install the Python 3, the reason why you’re here. To install the latest version of Python, just copy/paste the following command into your Terminal:
NoteBrush to use for highlighter.
You can confirm which version of Python was installed all by running the command below (the exact same command you tried earlier in this guide). It should show up as follows:
- Finally, let’s run our new Python 3. Simply enter
Download Python 3.7 3 For Mac
Voila! You have now installed Python 3 successfully if you see something similar in your Terminal:
Download Pandas For Python 3 Mac
•If you want to exit, type
exit() and then hit your Return button on your keyboard. You can also hit both Control and D keys at the same time instead of the Return key.
•Remember I mentioned you can run both your new Python 3 alongside your old Python 2? Yup. Simply type
python into the Terminal to run with Python 2.