- Hands-On Artificial Intelligence on Amazon Web Services
- Subhashini Tripuraneni Charles Song
- 162字
- 2021-06-24 12:48:43
Installing Python on macOS
While Python is pre-installed on macOS, that version of Python is 2.7. To install a newer version of Python, we recommend using a package manager for macOS called Homebrew. Homebrew is touted as the missing package manager for macOS; it simplifies the installation of many macOS software packages, including Python. To install Homebrew, follow the instructions on its website: https://brew.sh. At the time of writing, the command to install Homebrew in the Terminal is as follows:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Once Homebrew has been installed, we can install the latest Python and pip, the Python package management system, with the following commands in the Terminal prompt:
$ brew install python3
$ brew install pip3
Check whether the latest Python and pip version have been correctly linked on your system with the commands in the Terminal prompt:
$ python --version
$ pip --version
The outputs of these commands should state versions similar to 3.7+ and 18.0+, respectively.