Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Eventually you're going to need to use Python outside of Workspaces. In this video, I'll install Python on a Mac and make sure `pip` is available.
The official Python site, where you can download the installer.
If you install Python from the official download, you'll use the command python3
to run Python and pip3
to use pip
.
(also, wow, I totally called Spotlight "Safari")
[SOUND] As far as Tree House is
concerned we've been able to do pretty
0:00
much everything in work spaces
it's such a handy tool.
0:06
But you won't be able to use work spaces
for the code you write at a job and
0:11
you don't always have
the internet available.
0:14
To fix both of these issues we should
get Python setup on your own computer.
0:16
In this workshop we'll install Python
3 on a Macintosh computer, and
0:21
make sure pip works so
that we can install 3rd party libraries.
0:24
I think that's enough talking,
let's get to the doing.
0:27
So we start with going to python.org
as you can see I've already done.
0:31
Python.org is actually
a really great site.
0:35
You should totally be using this
site all the time anyway, mainly for
0:38
this documentation tab.
0:41
But we're gonna go here
to the downloads tab.
0:43
When I hover over this,
I can download for Mac OS X.
0:47
If you're on Treehouse using Workspaces,
you've seen either Python 3.4 or
0:50
some of the newer stuff as Python 3.5.
0:55
The current download here is Python 3.5.
0:57
Yeah, the versions are different, but
so long as that 3 is in there and
1:00
it's greater than a 3.3
should be just fine.
1:04
If anything does come up as being broken,
then I'll update this video,
1:07
I'll let everybody know on the community,
and we'll all be good.
1:13
So I'm gonna click 3.5
to download the .dmg and
1:17
I'm gonna let it just download here for
a minute.
1:21
So when this finishes downloading, which
it's got about a second left here, I'm
1:25
gonna go ahead and click that so that it
will open the dmg and run the installer.
1:30
And so here's the installer.
1:35
And we're gonna say Continue.
1:36
If you get a download, a dmg and you're
trying to run it straight from that dmg,
1:38
there's a chance this won't
run because it's not signed.
1:41
If it's not signed,
just right-click on it, choose Open and
1:45
then it'll run with no problems.
1:49
So we're gonna go ahead and
we're gonna say Continue,
1:51
and we're gonna say Continue,
and we're going to Agree.
1:53
Read through all that stuff,
of course, if you want.
1:58
Now, I don't need to change
anything on Customize.
2:00
But you shouldn't need to either.
2:04
So we hit Install,
we type in our password,
2:06
and we just let it run through its thing.
2:14
So yeah, you're good now, right?
2:17
So let's let this finish up, and then
we're gonna open up a terminal window.
2:21
And we're going to hit close, and
I'm going to pull up Safari and
2:25
open up terminal.
2:29
All right, so here I am in terminal.
2:32
In the Mac version, if I run Python,
2:35
I get the default Python that's on
my computer, and I don't want that.
2:39
I want Python 3,
which that gives me my 3.5.0.
2:44
So along that same line, if I do pip,
2:51
let's do pip --version here,
then you see that this comes from.
2:53
Well, actually it comes
from a thing I installed.
2:58
If we do pip3 though,
then you'll see that gives us our 3.51.
3:01
This is what we want to use.
3:07
We want to use pip3 if we're on the Mac,
so easy enough.
3:08
Right now,
3:12
I have basically the exact same thing on
my local machine as I have on workspaces.
3:13
So I can write code just
like I did in workspaces.
3:19
Pull up a text editor, write some code,
run it in the terminal.
3:21
You need to sign up for Treehouse in order to download course files.
Sign up