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, which is the recommended way to install Python packages
0:07
and create virtual environments in Python 3. This is kind of tricky to install on windows, so I'll show you how we do it.
0:14
First let's launch a command prompt by typing cmd into the search box here and we'll see that we don't have access to pipenv right now,
0:22
but we do have access to Python. Okay, so we have Python installed, but we don't have pipenv installed. So let's install pipenv.
0:31
Pipenv wraps virtual environment creation and pip utility into one nice little command line tool and in order to use it, we have to install it
0:42
so we can install it using Python and saying -m I want to run the module pip install pipenv and we'll try and install it here.
0:52
When I'm running this command, it's installing it into the system Python. It's going to think for a while but it's going to give me an error
0:59
because it couldn't install it into a certain directory because it doesn't have access to do that, and that might seem annoying or problematic
1:06
but it can be okay as well because what it allows us to do is sandbox our system install and not have any user trampling on top of it.
1:17
I want to install it, instead it's doing what's called a user install. So I'll show you how to do that.
1:22
Rather than saying python -m pip install pipenv, I'm going to add a --user option here and this is going to try and install it again.
1:35
And it looks like it worked this time. Let's try and run pipenv and we can see that pipenv did not run.
1:40
Why didn't it run? It's because our path can't find it, because we did a user install the directory
1:46
where a user install binary is installed is not in our path. We can look at our path by saying echo %path%
1:54
and we can see also where the path that the user install goes in by saying Python -m site --user-base. So inside of this app data roaming Python
2:07
is a directory that has our new pipenv guy, let's look at that. It's going to say dir app data roaming Python
2:16
and inside of Python there's a Python 3.6 directory and inside that, there's a scripts directory and that's where our pipenv executable is.
2:23
So what I want to do is copy this directory right here I'll just highlight it and hit enter and if I go down here into my search box
2:30
and type env, that will allow me to update my environment variable. I'll just click at the bottom there, environment variable
2:36
click on path and say edit and I'm going to say new I want to add a new environment variable path and just paste in what I copied there.
2:45
I can say edit. Okay. Okay. Okay, now note that pipenv will not work in this command prompt. So I'm going to close it, but I'll launch another one here
2:54
by typing cmd into the search box. I should have access to pipenv now. So this video showed you how to install pip in a local install
3:03
and how to update your path so that you have access to it from the command prompt.