Hi everyone. My name is Daniel Schorin,
and I'm a student assistant in this class.
Today, we'll be going over how to set up
your local programming environment on a Mac computer.
Starting off, while the Jupyter console
is included in Coursera,
it comes with all the included libraries and
packages necessary to run the lessons in this class.
Some people may prefer to
run the files on your local computer.
Today, we'll go over the steps
and help you do that in this video.
The only prerequisite for
this tutorial are computer running
Mac OS with administrative access
that's connected to the Internet.
We'll be completing the installation
using the command line,
which is a way to pass
instructions to your computer using text.
The command line is also known as a shell,
and it's a powerful tool for modifying,
automating, and organizing tasks on your computer.
On Mac computers, we use
the terminal application to
access the command line interface.
You can find terminal by opening finder,
and navigating to terminal and
the utility folder within the applications folder.
In order to download and manage libraries,
we'll need to download a package manager.
A package manager is a set of
software tools that automate
complex installation processes on
your computer which include downloading,
upgrading, and configuring, and removing software.
The most robust and common package manager
for Mac OS is Homebrew,
which we'll be using in this guide.
Homebrew is a free and
open source package managing system
that makes the installation process
on Mac computers pain-free.
To install Homebrew, copy
the following command and paste it
in the terminal as such.
Will go ahead and copy this link,
navigate to our terminal,
Control click, paste, and enter.
You'll see a script
asking for permissions download and we'll go ahead and
press "Return," and then
you'll see it download and install Homebrew.
So, Homebrew is software programmed in the language Ruby.
The installation works by modifying
your computer's Ruby path,
meaning where Ruby is installed on your computer.
You'll need to confirm the download
and enter your computer's password.
Note that your keystrokes will not display in
the terminal window when you're entering
your password for security reasons.
So, simply press "Enter" when finished typing
your password and follow the instructions and
terminal to finish the installation.
Once that's finished, you can check if Homebrew installed
successfully by typing
the following command in your terminal.
Just brew doctor.
So we'll go ahead and copy that,
go back and paste it,
and we see that our system is ready to brew.
Once Homebrew is finished installing,
we can download Python.
Homebrew comes included with a ton of
packages available for easy installation.
You can search for libraries to install
using the brew search command.
Feel free to browse Homebrew's packages on your own time.
Now, we can go ahead and install Python
3 using the following command and terminal.
Brew install Python 3.
So again, we'll go over copy that,
Control click and paste it, and press "Enter."
While Python 3 is already installed on this computer
you'll see a few different instructions
in your computer's terminal.
As you can see on our computer it
says we're already installed and up-to-date.
But if you just follow the instructions in your terminal
your Python will install correctly.
Upon entering that command the terminal should
be flooded with information about the download.
In addition to Python 3,
Homebrew will install PIP,
setup tools, and a wheel.
These are all libraries and packages for Python.
Pip assists Homebrew and Python package management.
We'll be using Pip momentarily to
download the Python packages
we'll be using in this module.
We can check the version of Python we have
using the following command Python version.
As we see we are working with Python 2.7.1.
While this is an older version of Mac OS,
we do recommend using Python 3 to download.
To update the version of Python on your computer,
we first recommend updating Homebrew.
You can do so with the following commands;
brew update, and as we
can see Homebrew is already up to date on our computer.
Finally, brew upgrade Python 3.
Great. Now we can see that Python 3.7 is installed.
Now that we have Homebrew and Python installed,
let's talk about Virtual Environments.
Virtual Environments allow developers have
separate spaces for different programming projects,
ensuring that the downloaded packages of
one project don't inadvertently effect another projects.
Using Virtual Environments can prevent
a lot of compilation issues,
and it can also give us more control
over our Python projects.
It's best practice to create
a programming environment for each programming project,
as you can create as many of them as you like.
Let's go ahead and create a Virtual Environment
for this class Py3.
First, we'll have to create
a home directory to house the files and for this course.
For this tutorial we'll put it
in a folder on our desktop,
although for you, you can put it wherever you like.
In terminal type "cd ~",
and that takes us to our home directory.
Then we'll type in "cd
desktop," and then we type the command
"mkdir," and the name of your folder which we'll use Py3.
We'll navigate into this folder using
the change directory or cd command.
Now that we're in our class directory,
we can create our Virtual Environment
simply by typing this command.
In this command, the 3.7
corresponds to the version of Python,
and Py3env is the name of our environment.
This command creates a new directory
inside of our Py3 home folder,
that houses a few files that allow
our Virtual Environment to run correctly,
isolating the project files so that they
don't mix with this system files on our computer.
The most important of these is the live subdirectory,
which starts out empty but will at the end of this lesson
hold the data for all the libraries
we install in this environment.
To use the environment we created we need to activate it.
We do this by invoking the activate script and terminal.
Wonderful. You know your Virtual Environment
is activated when you see
the name of your environment in parentheses
before the terminal commands in the application.
Now that we've created and
activated our Virtual Environment,
let's install the packages we'll need for the course.
We'll describe more about what these packages do,
and how to use them in different lessons.
For now, just run the following commands one at
a time in your Py3 folder
with your Virtual Environment activated.
Due to the power of editing,
we're going to speed through this installation process.
But understand that these packages may take
some time to install, so be patient with them.
Pip install pillow, tesseract,
pytesseract, numpy, matplotlib, and opencv-python.
With all the libraries
downloaded we're nearly ready to go.
We just need to get our files ready to run.
Let's navigate to the Py3 Coursera course,
download the Jupyter Notebook files with
the ipynb extensions,
and their accompanying data files,
and put those into the Py3 directory on our own computer.
To run these files, simply navigate to
our folder in terminal and type "jupyter notebook"
There you should see a folder for your files,
and you'll be all ready to go and
run these files within Jupyter.
Thank you so much, and have fun with this course.