Use the installer from the official website.
Important
Make sure to check Add Python 3.12 to PATH!
Use Homebrew to install Python3.12. You may need to install Homebrew as it is not pre-installed on macOS.
brew install [email protected]
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.12
pamac install python312
Anything that can edit plain text works for writing Python code. However, using a more powerful editor makes your life a bit easier.
There are a lot of applications to choose from, but for this course we recommend using one of the following two:
Visual Studio Code is currently the most popular text editor for most programming languages. Instead of including everything out of the box it relies on its built-in marketplace for extensions. We strongly recommend using the official Python Extension by Microsoft.
PyCharm is a feature-rich IDE dedicated to Python and comes with everything out of the box.
An IDE (Integrated Development Environment) is a text editors, that additionally provide helpful tools for running, managing and analyzing source code.
Once installed, you should be able to run Python Interpreter in Interactive Mode, also called the Interactive Shell:
python3.12
You should see something like this:
Python 3.12 (main, Oct 2 2023, 12:03:24) [Clang 15.0.0] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
The cursor should jump behind the >>>
, ready to input some Python code.
We will use this to run some simple arithmetics and operations in the next chapter.
Exit the Interactive Shell either by pressing Ctrl + D or by entering exit()
into the prompt.