Python 3, an illustrated tour Transcripts
Chapter: Virtual Environments
Lecture: Installing Pipenv on Windows

Login or purchase this course to watch this video and the rest of the course contents.
0:01 In this video, we're going to look at how to install the tool pipenv,
0:03 which is the recommended way to install Python packages
0:06 and create virtual environments in Python 3.
0:09 This is kind of tricky to install on windows, so I'll show you how we do it.
0:13 First let's launch a command prompt by typing cmd into the search box here
0:17 and we'll see that we don't have access to pipenv right now,
0:21 but we do have access to Python.
0:23 Okay, so we have Python installed, but we don't have pipenv installed.
0:27 So let's install pipenv.
0:30 Pipenv wraps virtual environment creation
0:32 and pip utility into one nice little command line tool
0:38 and in order to use it, we have to install it
0:41 so we can install it using Python and saying -m I want to run the module pip
0:47 install pipenv and we'll try and install it here.
0:51 When I'm running this command, it's installing it into the system Python.
0:55 It's going to think for a while but it's going to give me an error
0:58 because it couldn't install it into a certain directory
1:00 because it doesn't have access to do that,
1:02 and that might seem annoying or problematic
1:05 but it can be okay as well because what it allows us to do is
1:09 sandbox our system install and not have any user trampling on top of it.
1:16 I want to install it, instead it's doing what's called a user install.
1:19 So I'll show you how to do that.
1:21 Rather than saying python -m pip install pipenv,
1:25 I'm going to add a --user option here
1:28 and this is going to try and install it again.
1:34 And it looks like it worked this time.
1:35 Let's try and run pipenv and we can see that pipenv did not run.
1:39 Why didn't it run? It's because our path can't find it,
1:43 because we did a user install the directory
1:45 where a user install binary is installed is not in our path.
1:49 We can look at our path by saying echo %path%
1:53 and we can see also where the path that the user install goes in
1:57 by saying Python -m site --user-base.
2:03 So inside of this app data roaming Python
2:06 is a directory that has our new pipenv guy, let's look at that.
2:11 It's going to say dir app data roaming Python
2:15 and inside of Python there's a Python 3.6 directory
2:17 and inside that, there's a scripts directory
2:20 and that's where our pipenv executable is.
2:22 So what I want to do is copy this directory right here
2:25 I'll just highlight it and hit enter and if I go down here into my search box
2:29 and type env, that will allow me to update my environment variable.
2:33 I'll just click at the bottom there, environment variable
2:35 click on path and say edit
2:38 and I'm going to say new I want to add a new environment variable path
2:42 and just paste in what I copied there.
2:44 I can say edit. Okay. Okay. Okay,
2:47 now note that pipenv will not work in this command prompt.
2:50 So I'm going to close it, but I'll launch another one here
2:53 by typing cmd into the search box.
2:55 I should have access to pipenv now.
2:58 So this video showed you how to install pip in a local install
3:02 and how to update your path
3:04 so that you have access to it from the command prompt.