Install Python, PIP, Virtualenv, and Django on Windows 10 with PowerShell

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there in this one we're gonna be installing Python on our Windows 10 computer now we're gonna be using the guide that we have on our blog a quick shortcut is to this URL or right here and basically what we're gonna be doing in this guide is installing the Python programming language version 3.6 on your Windows 10 computer now if you have an older version of Windows no worries in this guide there is a way to install that as well so check out the bottom of the guide for that installation process because basically if you don't have Windows PowerShell on your computer you're gonna use something called command prompt instead and the guide near the bottom actually handles some of that installation although you might want to follow along with us at least for a little while because what we're about to do should also work on your system even if it's possibly even if it's as old as Windows XP seven eight and probably now ten okay so first things first we have to download Python so let's go ahead and open up the Python program or python.org slash downloads and we're gonna get the latest version of 3.6 so yours might say three point six point or download whatever that version is but you're not gonna just jump in and hit download instead you're gonna click the Python version 0.3 0.6 and then scroll down to files now here we actually want to download the version for our computer I think the x6 86 64 executable installer should work on both versions that is possible if you do know please let us know in the comments but we want to make sure that we get the right one for our system so if you are not sure what you have you are just gonna simply like we say in this guide we're gonna look for in cortana or this little search here we're just gonna look for system information this is one of a few different ways on how to get this and then this biggest system information box comes up and what I'll see is under system type I see it's x64 base PC so that means that I have a 64-bit machine right there that's what that means so we're gonna go ahead and download that version I don't need to leave that since some information open anymore so I'm gonna just gonna shut it out so I'm just gonna click and download this executable installer now I'm actually not gonna do it because I've already downloaded it for this video right so it's already on my downloads there it is right there so go ahead and pause it because you definitely want to have it all downloaded before you actually continue on so I'm gonna assume that you've downloaded everything and now we're gonna go ahead and open up the Python installer so just double click this and instead of jumping into just install now we actually want to customize the installation I'll explain why in a moment but we're definitely also going to want to add Python 3.6 to the path if I click on customize one of those things that I'm customizing is I'm ensuring that pip is installed on my system right I want to make sure that pips their pip is a Python package installer so it allows you to install things like Django or Python requests or beautifulsoup about a bunch of other things that really help make python the valuable thing that it is today of course pip is not the only way that you can do that but it makes it very very easy but for us is gonna allow us to install Django and more importantly our virtual environment which is something we'll do in just a little bit so go ahead and click Next after you have those things installed and I'm gonna get rid of that zoom and then for here we're gonna install for all users notice the actual library location changes I also want to make sure that Python is in environment variables make sure all of those are ticked the bottom two is not as important but definitely install for all users and for Python environment variables no of course you don't have to install for all users that's completely up to you but the environment variables that is a must in fact if you followed either our older guide or if you follow the bottom of this guide it actually sets up the environment variables for you like we manually set them up in that older guide so we're not going to do that here instead we're gonna just allow Python to do it for us the next thing is I'm gonna take this out of Program Files I'm gonna keep it just right in the sea route I like having it there and also I believe that the old version of Python being installed that's where it went by default again I like having it there so I know exactly where it is all the time of course in Program Files it's not that big of a deal but if you didn't install for all users I would still say put it here so you still know for sure where it is I'm gonna go ahead and hit install now it's gonna of course ask me to make sure that this is okay to install yes of course you 100% want to do that so while that's installing I'm actually gonna scroll back up we've got all of these things done right so if you're not sure about what all those that we ticked make sure you just go through that step two the next thing is we want to verify that python is installed in windows powershell so i'm gonna go ahead and wait for this to actually install but in the meantime I'm actually gonna jump one step ahead while that's installing to do update PowerShell settings now one of the things that we want to be able to do is run scripts inside of our powershell that is i want to be able to activate my virtual environment that's one of those things i'll point out that script when we get there but we have to actually do this at least one time we have to set this up to make sure our powershell actually works so what I'm gonna do is I'm actually gonna search for Windows PowerShell and then I'm gonna right click on it and click run as administrator it's gonna ask for a security thing of course say yes and then this is what opens up notice it's in windows system32 that that is what we want in particular I'm just going to go ahead and copy this execution policy that we have and it's really just set execution policy as unrestricted so let's make sure I copied it and the nice thing with PowerShell I can just right click and then there goes in I press ENTER and then I'm going to say yes or why to all things hit enter after that and now I have PowerShell setup in the way that I need to make sure my scripts run ok let's see how we're doing with Python Python setup was successful I'm going to close that out another quick shortcut to PowerShell which you might use in the future not to update PowerShell settings or what we just did but now going forward if you hit the Windows key and X at the same time you get this menu item instead of just the Windows key the Start menu doesn't pop up instead it's all this stuff this works for all kinds of versions for Windows so this time we're just gonna do Windows PowerShell not the admin version but just the PowerShell go ahead and hit that this opens up our windows powershell so let's go ahead and verify that Python was installed by typing out python - v and notice there's a capital b m-- i press enter what do you know pythons there if I do PIP it will give me a bunch of stuff as in it doesn't give me an error so like if I did ABC that gives me an error that is the error that you would see if you didn't install this correctly either one of those things and if that's the case if you didn't just open this back up uninstall it and try it again it should work just fine if you have issues and different sort of errors that that are different then let's say this please let us know in the comments below so we can possibly help you or somebody else could help answer that question too and if you are one of those people that have an error and you find the answer let us know in the comments because it helps everybody trust me on that one ok so we've got all this stuff installed we set a PowerShell to actually work now what we need to do is create something called a virtual environment now these things are important because of versions so if I scroll down a little bit and run something called pip freeze this shows me that I have virtual env installed you might not have that installed yet right there's a good chance that you don't you might not see anything here but what PIP it allows me to do is I can install something like Python requests I hit enter this installs the Python request library as you see it's also installing other requirements related to Python requests now this is something that's fairly important because if I do pip freeze now I see that I've got a bunch of things installed here right now if I used a different version of Python requests in one of my projects like what if I used version 1.10 or something like that and I wasn't ready to upgrade to the new version well that potentially creates an issue because if I have a new project that needs this new version what do I do that's what virtual environments are for it's about keeping your dependencies and the requirements for project nice in one little spot now you could go one step further and put it in an entire container something like like what docker does that is docker you could put it in an entire computer container where it's in it's in completely entire virtual and entire environment itself but we don't want to go that far that's getting that's getting way more advanced than we really need at this point so we use virtual environments to keep all of our projects data right in one place so we don't have any issues the other part of this means that if we want to learn from older versions of Python projects we can actually use virtual environments to do that as well so where do we store virtual environments now if you've watched my old Windows series setup nothing wrong with how it was set up there and what we did although those things still work to this day the things that I want to change is generally how I store things like where I actually store them and what I like to do with those things so I actually like to put it in a new folder called dev so if I list things out in here with just LS I see that I've got all of this stuff right so you might not have everything here but you'll definitely have Desktop and documents right so I'm in my users directory another place another way to get there is to just do that so that command right there will will definitely get you right where we are right now and of course that assumes that you're using the standard powershell and we list things out or dir it'll show me all of those things okay cool so now I'm going to do is make dirt mkdir dev and then I'll CD into dev less things out I see that there's nothing in there if I do PWD I see exactly where I am notice that I am using slashes differently PowerShell is one of those newer things or Windows that is actually really cool for stuff like this so it's it's a little bit more like the UNIX bash that is it looks a little bit more like Linux and Mac which is cool because that means it's uniform for all of us okay so now that I've got this I've got a dev folder I'm gonna make another directory so I'm gonna call this CFE home and this is where I'm gonna put my virtual environment so I'm gonna CD into CFE home and inside of here I'm gonna go virtual in the period I'm gonna go ahead and hit enter and allow that to install for a second as we discuss some stuff so all I'm doing is step seven right here and I have all of these things installed again if you don't have a virtual environment installed sorry I think I jumped that you're gonna do pip install virtual P&V just like that because if you get an error here you know that's what you'll end up doing okay so what I'm doing here is I'm gonna keep one folder per virtual environment in my case I actually have one virtual environment for every single web application or project that I do is this the most efficient way to do it maybe not it is it the most effective for the way I work absolutely so you're gonna have to figure out a way for you to do it and in and of itself like how you're gonna want to work in these environments so for example the coding fresh burners comm website that has its own virtual environment for our quor'toth co website that has its own virtual environment the requirements might be very similar but they're not the same they're rarely ever the same so I create an entire folder for that entire project so in this case the CFE home project is the virtual environment so I'm actually gonna name Django roughly the same okay so if it hangs a little bit just press ENTER and usually it finishes okay so now I've got this virtual environment installed and if I list things out I see that I've got include lib and scripts live in scripts are the important things here for us to understand or at least to note that it's there it is different than Mac and Linux Mac and Linux have the same windows has this so what we want to do is activate this virtual environment now remember how I did this update PowerShell settings part and I said oh we need to run scripts well that's what activating the virtual environment does we actually run a script and the script is dot slash scripts slash activate press ENTER that activates the virtual environment notice the direction that I did the slash flashes you can do either direction for slash or back slash either way doesn't matter it will activate so if I do deactivates to deactivate the virtual environment activate it again we got scripts activate I hit enter there it is okay so if I scroll up a little bit I'm gonna look at what I did when I said pip freeze here's that command pimp pip freeze and that gave me these different libraries right it showed me what I've have installed with Python so if I scroll down to my virtual environment and do pip freeze what am I gonna see I'll hit enter I see nothing that's because nothing's installed on this virtual environment that is an important and critical step to this this is the understanding that hopefully you got if you don't understand that definitely rewind a little bit so you can get a better understanding of how all that stuff works or let us know in the questions below I think I've really covered it a lot so I assume that you know it pretty well okay so now that we have our virtual environment activated we want to make sure it's activated and that's denoted by this right here so the parentheses with the name of the virtual environment in there that means it's activated and then it shows us our path so that is our virtual environment now I can do pip install Django equals equals to one point eleven point five for example and hit enter I'm gonna let that install for just a moment mines using a cached version of Django yours will not it unless you've already installed Django of course or specifically that version of Django so this is allowing installed and you can change these versions for any Python package all of them have versions so you can you can play around with the version number here but usually what I'd say is whatever the tutorial or guide says or video says go off of that version right like if we were going forward to create a Django project in this series which were not we're gonna do a very basic one but we're not gonna build a real project here this is all about getting our system set up but if we were gonna build a real project you don't want to divert from this version that is a rule of thumb that I highly highly recommend you you stick with okay so we have it installed awesome work if you liked our guide please consider sharing it with a friend that is also learning Python I don't want you to just spam everybody that that doesn't make sense but if they're also learning Python and they want to get it set up on their Windows computer let but please share this guide with them or share the Mac or Linux installation because we have that as well but we aren't done on the video the guide might be done but the video we are not we can actually do some more stuff in the video just so you can see how things are handled now if I go back into the powershell it's doing the installation process and it's there right so if i do pit freeze now I've got Django installed so I'm gonna do this all over again but with a new virtual environment and install Django okay and I'm gonna do it in a different way but it will still have the same effect so windows X I'm gonna open up a new powershell i'm just gonna go ahead and minimize this old one now get where are we going for our development folder we did CD and then dev slash dev and then i'm gonna do make dirt and in this case I'm going to just say win ve and B and then we'll change into win the env we list everything out there's nothing in there I'll do virtual a and B period I will say one thing is sometimes you'll see - P and then Python three that is just saying if you have two different versions of Python installed you want to declare which version you're gonna use in this case we only have one version installed so we're gonna stick with just dot period I'm gonna let that install real quick okay so virtual environment installed finished now what do we have to do yeah that's right we have to activate it scripts slash activate cool now let's go ahead and install Django I press ENTER and it's really bringing me back to where I was with that other powershell right so now i've got that other powershell installing notice that I actually didn't give a version so it gets the latest and greatest version that's not always recommended unless the latest version is what's related to the video as I've said a few times okay so now we're gonna actually set up our project so we use something called sublime text sublime text is a code editor a text editor if you will to actually handle the installation process or excuse me the writing process of all of our code so everything that we write in Python we're going to do here much like if you were going to open up a Word document and write a document you would use Word when you want to use code you use something called a code editor or a text editor for code and sublime text is one of those things that you can use now this is not free but I really recommend using this because it's really awesome and useful it's a very good program I don't have any affiliation with them although like one I don't have one and yeah you can download and use the entire full version for free regardless it's something else that's really really cool about it it just nags you to upgrade so anyways I'm going to open up my version of sublime text here and I'm going to add this folder in here as a example of creating our project so let's go ahead and just go project and we'll say add folder to project and then I'm going to navigate to the project that I just created the virtual environment that I just created it's in C Drive users J as in my user dev CFE home select folder okay great and now it's showing that folder on the side there and then I'm gonna gonna go ahead and save this project as and I want to go into where that project was as well and just keep it all in one place I love keeping it in one place if you haven't noticed cfb home we saved that in there okay great so now we could actually reopen this now if I was gonna make a Django project here I would go back in a powershell and list things out make sure i'm in the root of my virtual environment you know where scripts and lib are and i'm gonna make a new directory make dirt called SRC and then I'm going to change into SRC hopefully something you noticed is this folder was created and shows up on sublime text that's fairly important and now what I'm going to do is just do Django admin dot py start project CFE home and then period I hit enter and it opens up sublime text in your case it may or may not open up sublime text so this happened because of how I have my Python files currently working so yours may or may not do this if I go back into my project here I'm gonna just jump in to local disk users J dev cfp home and then I'm gonna go into source or sorry not source but scripts and we've got Django admin here I'm gonna read basically the the one below it is a Python file it says dot py or PI file I'm gonna go into properties here and I'm actually gonna change this back to opening up with Python I'll say ok and I actually want to change that one in particular with Python I changed it do that again Django admin not pi start project CFT home the period and there we go ok so now I actually have my project in here you probably didn't have to do that second step but if you ever want Python files opening in sublime text you have to do what I just did so if I go into that project again so dev CFE home and a source and I want to open something like that it's gonna change as to where I open it with so I can edit it or I can go to open width and then choose another app and then do sublime text and there now it actually opens that so the reason I put in the project itself is so when you open these files they open automatically they don't just try and run as a Python file it's it's one of the things that happens pretty much only on windows as far as I know so now we have our general project we can actually just go ahead and run in here python managed to py run server there we go so this is a emulated development server I can copy this URL here so let's just copy it and actually I'm going to press up and enter one more time because ctrl C actually turns off the server too so keep that in mind so now I'm gonna go ahead and paste in that URL boom you now have Django installed and it's working and it's ready to actually start an actual project so before I go away though I want you to go back and do everything that I just did so that is controlling C to break out of the virtual environment alright the the running server I'm going to go back type out deactivate to deactivate this and then I'm going to go back to my dev folder and I want to remove these directories I believe it's remove rmdir CFE home and we'll say yes to everything and I'm gonna remove dir Wynne V and V and again yes to everything it looks like I got some issues there remove dir win P and V and we'll just say a and I'm getting some permission denied error that that's that's fine but basically I'll just delete it here shift leet it's probably because it's in use that is exactly what it is so let's close that out and that was a problem okay so now I'm gonna leave it off with you guys having the ability to do this on your own I want to challenge you to do it on your own and you can actually follow along with our create a blank Django project guide in addition to this Windows installation to actually create a like a good practice for a Chango project to get Django started if that's where you're gonna go next if not definitely consider checking out our 30 days of Python that uses Python version 3.6 and it's gonna help you understand Python just a little bit better now we have a lot of projects in here as you see so 30 days of Python is one of those projects that will give you a lot of the basics of Python and get you going to a point where you'll have a better understanding of how to do web scraping also working with api's and all sorts of things that python has to promise as as a foundation to move or like if you're not ready for Django quite yet 30 days of Python is a really good place to start if you are ready for Django you can check out our latest version of try Django the try jingle series is always about the basics of Django itself so consider trying a 1.11 or you can go backwards in versions two because they are still very Django so so yeah the versions changed but a lot of things about them are pretty much the same and then finally there is on our YouTube channel join CFE comm slash YouTube that will redirect you to our YouTube channel so you can actually see a lot of the try Django series here there's a lot of it there and there's there's some Python stuff as well like web scraping on there as well so you can use this as a resource to get some of that free understanding behind Django and Python as well some other things like angular and some JavaScript stuff too but please consider subscribing for that if you want to see more content just like this I realised we went through a lot of stuff in this one and we went fairly quickly and it was a little bit long of a duration but the point of this was really to just have you working off of that guide I mean that guide is really gonna be the thing that you'll probably end up using you'll probably pause the video maybe even stop watching the video and just go off of the guide there's nothing wrong with that at all but I just wanted to give you this extra context in a video form so you have a hopefully just feel better about installing Python on your local system because this guide itself I mean it's yeah there's probably got another guide out there that talks about this exact same thing so the guide itself is not the important part it's actually understanding all the context that goes into this and that's why I really made this video in addition to this installation process so thanks so much for watching my name's Justin Mitchell I am the founder of Cody French burns comm and I absolutely love coding in Python and building web vacations with Django these things are have been very important parts of my life for the last five years and they will be for many many years to come because of artificial intelligence and all the things that I'm really excited about that I'm just not quite ready to share courses on thanks for watching and we look forward to seeing you in the next one please say hi I would love to hear from you tell me where you're from what you're trying to work on whether it's on the guide itself or on a YouTube channel I get a lot from you guys especially if you ask questions I actually learn a lot from the questions I probably learn more from the questions that you guys ask and have had a bass then the things that I research on my own because I don't know the things that I don't know I don't know the questions that you might be asking that really that I mean that those are the things that I really encourage you to ask because as a beginner you might ask questions that you think aren't that great of questions but they might be subtle enough that they're actually such great questions because they come up over and over and over again and that's how I'm able to improve videos and improve guides and help you guys more help everybody more so please don't hesitate to ask a bunch of questions if you want I mean we also try to make it easy to find a bunch of answers in our videos so sometimes the questions might be rely in a video and that's where if you're like oh well how do I install Gengo or how do I get Django started well that's where you take a whole series like try Django there anyways thanks so much for watching and I look forward to chatting with you more in the future
Info
Channel: CodingEntrepreneurs
Views: 143,686
Rating: 4.8748403 out of 5
Keywords: djangourlshortcfe2017, django 1.11 tutorial, django tutorial, install django on mac, install django with pip, install django with virtualenv, virtualenv, python django, Django Web Framework (Software), Python (Software), web application development, learn django, installing django on mac, pip, python package, django, kickstarter funded, beginners tutorial, trydjango2017, 1.11”, “muy, picky”, “django, basics”, windows
Id: 3TqO5FfhV28
Channel Id: undefined
Length: 30min 22sec (1822 seconds)
Published: Tue Sep 26 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.