Package Manager
A package manager is a tool to automate the installation process of computer programs. Popular choices are Homebrew on Mac OS X, apt on Ubuntu and Chocolatey on Windows.
Homebrew (OS X)
Setup Homebrew
Fire up the built-in
Terminal
application from your Mac, and paste the following command into it. (You can always use the search button located on the top left cornor on your Mac to findTerminal
)ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Note that this might take a while, especially when installing Xcode Command Line tools.
Then paste the following command into the same terminal window and press
Enter
.echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
- Close the current terminal window.
Use Homebrew
Open up another terminal window. Enter the following command and press Enter:
brew update
Which updates Homebrew itself, all the formulae it contains and install git onto your Mac.
Now, you can easily install Python 3
by brew install python3
.
However, due to some compatibility issues, it's the best that we use
Python 3.4
, instead of the latest version. To obtain and install the
formula of Python 3.4
, enter the following command into the terminal:
brew tap 20015jjw/python34
brew install python34
python3 --version
Since this is not an official formula, you will see an error. Let it
be. In the end when all the command finishes (you might need to press
Enter
once more to execute the last command), you should see this
line on the screen:
Wills-Mac-Pro:src Will$ python3 --version
Python 3.4.4
As you can see, Python 3.4.4
is installed on your Mac and can be
accessed by typing python3
into a terminal window.
More Usage & Mac Setup
To setup your Mac OS X properly for development, you can consult this
book by Sourabh. It covers many useful tips for setting up
different kinds of development environment. You should definitely take
a look at the Cask
section under Chapter 3, as it allows you to
install almost all the useful applications with a single line of code.
Chocolatey (Windows)
Install Chocolatey
- Open the start menu, enter
cmd.exe
and right-click on it to run it as administrator. Paste the following command into the command line window and press
Enter
(The line is really long, and right-click on the terminal to paste):@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
- Restart the shell (Command Line Prompt, Gitbash or Cmder)
Use Chocolatey
Simply run the following command in a shell that runs as
Administrator to install Python 3.4
:
choco install python -v 3.4.3