Alright guys, so, we've already learned
about installing and using Python within
Mac OS and Linux. Those two operating
systems actually have a very similar
process that's because they're both
derived from the UNIX operating system,
where Windows is not. So, Windows is a
little bit different, so I'm going to
walk you guys through this right now. You
need to go to python.org, once you get to
python.org you need to hover over
downloads here, and then
find Windows here. It should also be
defaulted to Windows if you're on
Windows. So, we're going to be choosing
which version we're going to be using
and we are always going to be using
Python 3 not 2, so ignore Python 2.
Click Python 3.6.1 and
it's going to download the installer for
you. Now, when this is done downloading we
can install it. So just launch the
program, and let me just uninstall
this first so that I can
reinstall it. While this is
uninstalling we're going to be talking
about the environment variables and why
you need them, and when I installed
Python on Windows a while back there was
a problem with the path, or maybe not the
path but specifically the Python
installer package which we're going to
be discussing. And if you guys do have
the problem that I had it's going to be
terrible, but there's an easy
workaround for it. Alright, so, let's close
that and then run the Python 3.6
installer. Now there's one very important
thing that we need to do and that is you
need to check add Python 3.6 to path, and
then click install now. Now while that's doing that, I'm going to search for
control panel here, and in the control
panel let's go into system. If you don't
see this view
right-click up here and select small
icons. This should work on Windows 7
8, or 10, and everybody should be on
one of those operating systems anyway
because, Vista might not be end of
life yet. Vista it was either
April or May that that was happening and
it's April now. So, anyway, if you're on
Windows 7, 8, or 10 go to system
and on the left-hand side click advanced
system settings. It's going to pop this
up right here. Specifically, if you are
not on the Advanced tab to begin with, if
you're someone over here, go to the
Advanced tab, and now here at the bottom you're
going to see an environment variables
button. Click that and it's going to bring up
the environment variables configuration
screen. Now the specific one that we're
interested in is the path variable. These
are system variables and these are user
variables, I'm going to double click on
this path variable and as you can see
we've got python 3.6 3.2 added to the path
which means every time I run a program
that resides in one of these paths,
Windows is going to know where to look
for it because it's going to check all
these paths first, and then all these
paths in that one. And then if it
doesn't find it then it's going to say,
okay, well, I don't really know what
you're looking for, and that's why we add
paths to the path variable. So, that has
been added, if I open up a command prompt
here you will see that if I run Python
it's going to successfully find it and run
the program. Now that is because I have
it installed to that path. Up here you
can see users, my user, app data, local, etc.,
and as you can see
right here that is the path that was
added. So, every time I run Python this is
one of the first paths it checks, and it
goes well, do I have a Python.exe file,
and it does. Now you can also run all of
the programs from the scripts directory
including pip, and so that's what we're
going to talk about right now. Let me
exit out of here. So, pip basically for
example if you wanted to build a web
scraper or a web crawler and
if you just wanted to have a program
that would download certain pages, what
you would have to do is build scraper.
And in PHP, for example, you have access
to curl, it's shipped with
curl. There is no default requests
library for Python, so you'll have to
install one. And usually you are
going to be using some type of framework
or library within Python just because
it doesn't make sense to continue
rewriting things that other people
already have. So, you're going to be doing
a lot of this, so I recommend getting
used to it. We're going to go ahead and
install a package that we're going to be
using for web scraping and that is
called requests. So what you need to do
is type pip install, and then the name of
the package you want to install. Now this
is the problem I was getting before so I
guess a reinstallation did not fix the
problem, and I have no idea what the
problem is I've been reading this stack
overflow thread and so far I haven't
discovered what the problem is, but there
are a few workarounds. So number one
probably the one we're going to go with
is since you can run Python from the
command line because that's been added
to the path you can actually work around
this by typing python -m pip
install requests, and I've already got it
installed so it's just going to say
requirement already satisfied, but it
should install for you guys.
Anytime you see me in this course type pip
install anything, all you Windows guys
remember use python -m pip install
and then whatever you're going to
install. So that is how you install
things with pip, and now once we've got this
installed if I were to jump back into
Python you can just import the library
that you just created, and now you have
access to that class. And that is how to
get set up with this stuff on Windows. I
hope you guys enjoy this course, I'm
definitely going to.