Installing Python 2 on Mac OS XThursday, October 11, 2018 - by Keith A. Smith
OS X comes with a
large number of UNIX utilities, those familiar with Linux systems will
notice one key component missing: a decent package manager. Homebrew fills this void.
Homebrew is a package manager for OS X. A package is a collection of code files that work together. Installing them usually means running a script (a bit of code) that puts certain files in the various directories. A lot of the packages you will want are going to have dependencies. That means they require you to have other packages already installed on your computer. Homebrew will find and install dependencies for you AND it will keep them organized in one location AND it can tell you when updates are available for them. On top of all of that it gives super helpful instructions when everything doesn't go smoothly. You can read more about it at Homebrew's website. For now, install Homebrew using the following line of code: $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" The
script will explain what changes it will make and prompt you before the
installation begins. Once you’ve installed Homebrew, insert the
Homebrew directory at the top of your export PATH="/usr/local/bin:/usr/local/sbin:$PATH" Now, we can install Python 2.7: $ brew install python@2 Because export PATH="/usr/local/opt/python@2/libexec/bin:$PATH" Homebrew names the executable $ python -V # Homebrew installed Python 3 interpreter (if installed)
-End |
Tweet |