Install PySide2 on macOS

Install PySide2 on macOS
Heads up! You've already completed this tutorial.

Before you start the PySide2 tutorial you will need to have a working installation of PySide2 on your system. If you don't have either set up yet, the following steps will guide you through how to do this on macOS.

This guide is also available for Linux and Windows.

Install PySide2 on macOS

If you already have a working installation of Python 3 on macOS, you can go ahead and install PySide2 as for any other Python package, using the following --

bash
pip3 install pyside2

If you don't have an installation of Python 3, you will need to install one first. You can download macOS installers for Python 3 from the Python homepage. Once installed, you should be able to use the pip3 install command above to install PySide2.

Another alternative is to use Homebrew. Homebrew is a package manager for command-line software on macOS. Homebrew has both Python 3 and PySide2 available in their repositories.

Homebrew -- the missing package manager for macOS Homebrew -- the missing package manager for macOS

To install homebrew run the following from the command line --

Create GUI Applications with Python & Qt5 by Martin Fitzpatrick — (PySide2 Edition) The hands-on guide to making apps with Python — Over 10,000 copies sold!

More info Get the book

bash
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

This is also available to copy and paste from the Homebrew homepage.

Once Homebrew is installed you can then install Python with --

Create GUI Applications with Python & Qt6 by Martin Fitzpatrick — (PySide6 Edition) The hands-on guide to making apps with Python — Over 10,000 copies sold!

More info Get the book

bash
brew install python3

With Python installed, you can then install PySide2 as normal, using pip3 install pyside2, or alternatively choose to install it using Homebrew with --

bash
brew install pyside2
1:1 Coaching & Tutoring for your Python GUIs project
Martin Fitzpatrick Python GUIs Coaching & Training
60 mins ($195) Book Now

1:1 Python GUIs Coaching & Training

Comprehensive code reviewBugfixes & improvements • Maintainability advice and architecture improvements • Design and usability assessment • Suggestions and tips to expand your knowledgePackaging and distribution help for Windows, Mac & Linux • Find out more.

Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak
Martin Fitzpatrick

Install PySide2 on macOS was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt. Martin founded PythonGUIs to provide easy to follow GUI programming tutorials to the Python community. He has written a number of popular Python books on the subject.