2021 Mac OSX Set up: Brew, Python3, pipenv, Pycharm

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video i am going to show you how to install python homebrew pip env and pycharm on a mac osx computer this is being filmed in april of 2021 so for any of you watching this in the distant future this might be different from how it should work um say if you know we're looking a year a couple years in the future watching this video there are a couple different resources that i'm going to use in this video and one of my favorites is this the hitchhiker's guide to python and this installing python 3 on mac os x article if you read through it it really helps i'm actually going to be following most of the steps in this video or in this article on this video and the first one is installing the xcode command line tools or the osx gcc installer i prefer just installing the command line tools you can click on here and it will take you to the apple developers page where you can install tools for working with apple products like mac os x and i have it pulled up here because i've already logged into my account and everything i don't usually download the beta versions you can see command line tools for xcode 12.5 beta 3. i'm just going to go with the stable version which is going to be right here command line tools for xcode 1214 and all i'm going to do is i'm just going to click the download button and i'm on firefox so it's going to ask for my permission and we'll see what happens after the dmg file has downloaded i can go to my finder and my downloads and i'm just going to double click on the command line tools it might give me some sort of message about installing something from the computer but it doesn't seem like that so i'm going to just go ahead and double click on the package and it's going to take me to the installer page i'm just going to kind of zoom through all this stuff yes i agree it's going to install it's going to be 2.5 gigabytes and it shouldn't take too long but i might stop the video if it does take a while with the command line tools package installed and ready to go i am now back in the tutorial where we actually got the link for the command line tools and the next thing is to install homebrew um it looks like that this link is or this command to install homebrew is up to date but in the recent months i thought it was out of date so what i usually do is i usually just go to homebrew.sh this is the home page for homebrew and i just copy it straight from there this is kind of the official install this you know run this command if you want to install homebrew and so i copy this and i will open a terminal and all i'm going to do is i'm just going to paste it in there and i'm going to press enter okay so it says it's going to install all these files says these scripts will install the following new directories will be created great so we're going to hit enter and homebrew might take a second after homebrew has been installed we need to tell our computer where our homebrew version of python is going to exist and to do that we need to work on our path variable and the path variable is really a user configured piece of information that tells the computer where to look when searching out software's programs and executables and so if i go to my terminal that i have open i haven't added this file just yet but if i echo my path variable and i hit enter you're going to see user local bin user bin bin user s-bin and s-bin that's the order of locations that my computer is going to look when i'm trying to search for something so if i say which python 3 you're going to see user bin python3 so right now there's no python in my user local bin but there's a python in my user bin and then there's python three okay so in the new max they use zsh rather than bash and for each user they should configure their own dot zshrc file i've already made one but i haven't put anything in it so i'm going to nano tilde slash dot zshrc this is the name of my file right here and we are going to open it up and you can see there's nothing inside of it all i'm going to do is take this line right here this executable line i'm going to copy it and i'm going to paste it in there so what is this doing it's exporting so changing the path variable now to user local opt python x libx bin and then whatever my current path is so the path that we just outputted the one that we just saw with the different lists of directories that is going to just get tacked onto the back of this location right here so if i do control x and then y to save the changes and i press enter because i want to keep the name of the file the same i'm just going to hit enter now i'm going to run source and i'm going to call the name of the file and i'm going to hit enter you shouldn't see any sort of output we're going to run that same command again echo path variable so tell me what the path variable looks like and you can see now we've got user local opt python lib x been before the rest of our path that currently existed before we just ran that uh that code now what i just did is not necessarily the safest way if i was to run source again you would see that the path variable gets all long and tangled up and you have repeating directories there's much more sophisticated ways to do this but just for time's sake and just to get the python up and running this is the best way to do it if you're just just solely focused on getting python up and running not trying to build out you know a very customized uh shell environment okay now we're ready to do something cool let's actually use brew to install python and the line is right here so it says now we can install python 3 with a simple brew install python this might take just a second but you're going to see that it's uh locating a lot of files online it's going to update brew a lot of the times it updates brew before it does anything but then after that it goes right to downloading python so this will take a second i'm going to pause the video and come back right when it's finished python has now successfully been installed to my computer using brew and we can actually check by running the which python command again so which python i'm actually going to do which python 3 and you can see user local bin python 3. if you read the output from the downloading when you do brew install python 3 it says that it's going to install it to user local bin and we can actually go to user local bin so i can just run a cd user local bin and if i run an ls you can see i have a python 3 a python 3.9 a bunch of different python 3.9 and you're like okay well why did it install it there but in reality if we do ls list all la you can see that these are all sim links like i said to the seller folder where python is located so seller python 3.9 3.9.4 been python oh pydox i grabbed the wrong one but if we look right there that's the python in question and so the python three located in user local bin is actually um simply pointing to the python in seller python at 3.9 3.9.4 bin python 3. okay this is the brew installed python 3. now whenever we run python if i just run a um i'm going to clear this output i'm also going to go to my root directory so you can see i can call it from anywhere i can say python3 and you can see yep we're running python 3.94 and i'm going to exit now something we haven't talked about is pip and pip comes pre-installed when you install python through brew and pip is just the package manager so it's going to be used to go to pi pi or some repository that you've set up usually it's pipe.org and that's where you're going to actually get your python tools you know different different modules and packages that we'll cover later on in different different videos but i can also check the same thing as i did which python i can say which pip three and it'll say user local bin pip3 once you have made it to the end of this first tutorial that we've been working through you're going to get to a section that's called pip env in virtual environments now pip env in virtual environments are just another tool on top of python so we just installed a version of python to work from that was separated from the system-wide python that comes pre-installed with the software now we're going to install a tool to help us further isolate that version of python from our project so that every time we create a new project we're going to create a new instance of python so that whatever we do to it throughout our project whether we add new files or create new tools or download tools whatever we do is going to be isolated to that one instance so that if you have you know say four or five projects and they all use the same tool but maybe different versions of that tool all of your programs across your system will still work because they're not interacting with those versions of the tools only the single instance of the tool or python that you're working with for that project it all gets in contained through pip env installing pipimv is super easy we're just going to use the same pip3 that we downloaded with our brew and we're going to say pip 3 install pip env and mine's going to show that i already have it i've already downloaded it once so if i say which pip env it's going to say user local bin pip env the final thing that we need to download is the programming environment i personally love to use pycharm i think that it's a great ide or integrated development environment but that's really just for my preference it's what i like to use is what i've been using since i first started coding with python you really can use any text editor you want i think charm has a lot of really cool features and plugins now there are plenty of other environments programming environments that also have awesome plugins you know auto complete all the special hotkeys and things you can do but sometimes i also find myself programming in just sublime text but pycharm is really where i like to control my larger projects and things so before i go ahead and just install it i want to show you how you'll know how to install it with brew you can say brew search and then i'm looking for pie charms so i'll say pie charm and brew is going to pop up the available softwares for me and so this is what i'm really looking for is pycharm ce for the community edition so i'm going to say brew install cask and then i'll say pie charm oh pie charm make sure i spelt it right and then i'm going to put ce and then i'm gonna hit enter and this might take a little while because pycharm is a decent sized software so i will cut this video off and start it back up in just a minute awesome so pycharm is now uh installed and i can actually go to my little launch pad and you can see right here that pycharm has been installed and so i can just click on that and it's going to go ahead and open up a new project yep we're going to open because it's the first time opening uh no i don't really want any of this stuff i confirmed that i have read and gave you all my data yes you can have all my information oh this is a new screen i haven't seen projects uh basically we're gonna do create new project and this is the uh important part right here you gotta name your project we'll say project test and i'm going to click pip env okay so we just went through all that process to download uh python and pip emv so we want to make sure that we're using the pip env you can use virtual environments you can use conda um i i use pipi nv it's just what i like to use and that's why i'm going over all this stuff so pip env click and you can see user local bin python 3.9 it's going to be named uh project test and like i said by doing this we're creating a whole new instance of python so yes it's we're going to be building the base interpreter from the user local bin python 3.9 but it's going to be located in a different um different location a virtual environment so if i do create you'll see that it's going to create this project and i can actually show you that the python instance is a different instance of python here in just a moment i recommend not trying to don't show those especially if you're new to pycharm these tip of the day little window that pop up that can be a little annoying but i actually really find them to be helpful and you can just like kind of scroll through all of it and just like learn one little new thing every time you open pycharm up and i think that that's a really really cool little feature so i'm going to close this anyways we've got our project and then we've got all of our um code okay i can take a look here so you can see user carter dot local share virtual environments project test and then this is our instance of python right here okay so that's one way to see it i could also go to my terminal and i could say which python three and you can see that rather than showing me user local bin it shows me this location and that's because i've created a virtual environment and now my python is safe and my project is safe so now anything i do to my project whether i destroy the version of python maybe i go into here and i decide i'm going to delete this whole entire email tool right here i'm just going to delete that whole thing yes it might cause a lot of issues but it's not destroying the version of python that i have on my local computer so i can simply just delete this project and start a whole new one and start with a fresh instance of python so that's all i was really trying to get to in this video is getting python set up on the mac computer and um i'll have the link to the article that i used and the link to the brew and even to pycharm home page as well if you want to check that out before you go ahead and start downloading everything i hope this video was helpful and thanks
Info
Channel: Cart's Coding Club
Views: 5,877
Rating: undefined out of 5
Keywords: python, mac osx, pipenv, brew, pycharm, virtualization, coding, programming, computers, basic
Id: GH4TonRGL4o
Channel Id: undefined
Length: 17min 0sec (1020 seconds)
Published: Wed Apr 14 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.