How to Setup PyCharm and Python (macOS)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up everyone welcome back to stage driven decisions i'm liam hartley today i'm going over how to install pycharm and python so you can get up coding nice and quick and get all your projects done stay tuned and let's go so first of all we need to go get pycharm so let's go over to jetbrains i'm just going to put it into google real quick jetbrains are the software company that developed pycharm and a few other ideas as well so if we go into developer tools here you can see pycharm and the id which i use on my personal computer which is intellij and another exciting one we're going to talk about quickly is data spell and um like i said i use intellij at home but i use pycharm at work to be honest they're quite similar um there's a few differences especially if you like notebooks pycharm is an incredible ide for notebooks data spell upcoming maybe a future exciting idea to watch intellij it's actually made for java so it's definitely not orientated towards python but i find it does most of what i want when i'm trying to code in python as well but then if i'm switching over to java then it gives me that flexibility and i don't have to have another id so that's why i prefer using it at home but five channels we're gonna go through today so i'm gonna hit the download button download pycharm boom so professional is the paid version community is the free version we are gonna go for pure python development and i want to download cool and now we wait okay so while that downloads we're going to go get ourselves python right now welcome to python.org here we are the landing page of python and go to downloads we can see the latest version there's operating system i'm running as well and i can hit the download button here and again it's going to download this one here so i'm just going to stack up those downloads and we're going to go into it so 3.9 you might want to use an older version because there's generally less documentation for newer versions of course so this one only came out back in october 3736 solid solid versions of python highly recommend but sure three nines got some exciting uh exciting features as well of course the fun fact python three nine we've got a latest dictionary merge and update operators used to put dictionaries together like this now you do it like this which is so much cleaner so yeah just check the release notes see if there's any features that stand out for you if you are interested but if you're beginner just maybe get three six three seven so you can get more support for it but go for 39 if you want to you want to get adventurous and try out some of the some of the latest similarities things yeah yeah yep i mean you saw me read it right and password so just i'm packaging the pkg file now so i'm gonna see what happens if i type in python right now two seven two seven this is embarrassing um okay so once you have python downloaded you are probably going to have something that looks like this and inside here you have an install um certificates command and you have update shell profile command so this this script is going to set up your path variable for you and what that means is when i type in python for instance into my terminal then what i get back is whatever python links up to an environment path which then points to the executable which then takes me into python so as you can see i've got python 2 7 set up for when i type in python but when i type in python 3 i get the one that i've just installed because the installation for me are now on three nine but if installation doesn't do it for you you need to run the shell command is this gonna work all right you're a python lover already okay so i've already got python installed so this shell command did nothing for me if dragging it into a terminal doesn't work as nice as that dicks i've never actually seen that before you just type in sure and then wherever that location is so for me i think this is inside my applications yeah in applications next to all my other pythons um cool so that's it that's how you get python installed now we've got python installed let's go back to pycharm and let's get pycharm working pycharm community 2021 let's go so just moving pycharm into my application space the debugging functionality is incredible it's actually why um i use uh the jetbrain products over any of them if anyone would like to fight the case of vs code then please put a comment in down below and i will pin the top comment for whoever gives the best argument for vs code um as much as i love jetbrains you know we've gotta we've gotta have a balanced debate here so i wanna hear why you think that um this is any better so from here you're going to have a blank setup but we're just going to go to a new project i'm just going to call this project hello world and right so this is the sticky bit right it's getting your interpreter working correctly and as you can see i've got that base interpreter which came in earlier when i type in python and it's my python two seven but as you can see in my local binaries i've got a few others lying around as well and in the frameworks as well i think this is actually where it gets installed too so so in the frameworks is where your installation is going to happen if you're on mac if you're on windows then make sure you check that script that they ran earlier to find out the installation location or give it a quick google you should be able to find it um but i'm sorry i have no access to a windows machine so i can't show you like i can't show you this today i'm going to pick up my new interpreter it's asking if it wants to make a new environment so in python you have environments and when you're inside an environment you have your packages and packages are like lots of new functions and methods that you can call pandas is a very popular package for instance and you know pip install pandas and then you have pandas and you know i might have pandas too and someone else has pandas three and i can pick this to whatever version i like into that virtual environment so each virtual environment is used for different projects so i'm going to use virtualenv which is just a package management tool it's just something that we use to you know like have a virtual environment so like conda does it as well quite famously but i'm gonna go virtualenv um these are some other interpreters i've configured but we're not gonna worry about that for now so we're gonna set up a new environment um we're gonna put it in my hello world project and we're gonna call it vend and we're gonna leverage the three nine which i've just downloaded so we're gonna create that it's gonna take a second just to spin up the id and to create that virtual environment which i was just talking about here we go you jerked i could probably just press play and it's gonna do it look at that look at that i'm gonna go over some of the painful things anyway so you can configure this for new projects as well so inside here you have your run and debug configurations and you can have as many of these as you like i could just like copy a few out whatever they're going to do exactly the same thing so the point is that you point each of these to a different script so if i had my main function but i was like actually i want to run my transform function then i point it to my transform python file i don't have another python file here but say for example i just change it to transform.py right and then also importantly you have your environment variables so i'm just going to go back to the main here pi environment variables um for instance if i pass in my hello environment variable or actually a more legitimate example is api key and my api key is blah blah and then if i apply this then print my environment variable hi liam blah blah which is my environment variable so this is how you can pass sensitive information without having to commit it to github this is where you should put it inside your environment variable section um and any you can potentially only do any sort of top level configuration here as well python interpreter this is the virtual environment piece that set up earlier we said we want to leverage the framework in python 3.9 that we've downloaded and now we're going to use an interpreter that was spun up by vn and here it is they've made it for us hello world and we can go into some of the packages that are on there in a second as well you've got some other fun features here like allow parallel runs so it means that you could run this multiple times i'll show you real quick if i just um if i press play well maybe if i debug and then i debug again you see i'm just loading up i've got a few coming down in my tab and my debug console and i can run it as many times i like which means i can step through this in any way shape or form so inside preferences you'll find the python interpreter section and in here we have the packages which i was talking about earlier and i can do my package management through here so going back to the pandas moderator i was talking about earlier the powerful data structure the data analysis let's go i'm now installing pandas and it will just sort it all out for me in the meantime i'm gonna go over the debugger real quick so i can just press play and i'm gonna play but if i debug wherever i put these break points here right it's going to stop the code so the first place it lands on is print high we're about to call this function i press play it's going to resume until i get to the next break point which is my import os statement again nothing happens but we do have a variable passed in here and this is why it's so incredible because if i want to play with that variable i can be like name is this and then i can i don't know slice it up in some way and i'm allowed to play that variable however i like i can even completely change it if i want if i was like actually name is lol then now name is lot and we're going to pass it through and we're going to print lol and our api key once i press play we've imported os play it again boom so that debugger is incredibly powerful if you're trying to work out what's wrong with your code you just step through it you pick it apart in different pieces you work out what's going on and then you modify that with the correct code that you can work out inside that debugger as well which is sick back to the interpreter and we can see pandas is installed as well as all of the other packages it needs such as numpy such as pi tz and if i go down here i can type in import pandas and it's going to know exactly what i'm talking about and i get all of the um i get all of the methods and all the functions that come with it so of course the most popular one is data frame so down in the bottom you should also have a few pieces on the ribbon down here and python packages is one of them which again allows you to see all of the packages that you're managing and if you're actually inside your environment um like i am here in this terminal it should put you in if you set up your um if you set up with vn from the start then you can see that if i type and pick freeze i see all of my packages as well and if you're not inside your environment then it should have been created inside vm so you just go source then uh what is it source then bin source then bin activate and i'm already in it so it's not doing anything and again if you want to come out of it and you've set up a new version environment and you want to change it you just deactivate that one now i'm outside of it if i do pick freeze i'm gonna get my probably python two seven yeah so i don't know it's just a ton of packages but if i get back now i'm back inside my virtual environment check my packages again boom it's not very clear but it's that okay so i got a question from a subscriber who wanted to see how to pip install a git repository repo as well so i'm going to go over that real quick the repository in question is of course the gemini repo from the bitcoin back testing video and we are going to copy this as a package into our virtual environment now so what you do is you take the https link you copy that one over and then pip install git plus the link and it's going to take it from there and clone it into your package and then you can use it just like pandas just like anything else and then here i'm gonna be able to do import when it thinks about it import gemini and use the functions which we use in the other video you'll see here in a second so in here you have all of your external libraries that you are using in your virtual environment there we go it's refreshed now all right so you can see we've got gemini down there over here that's the point i don't have to point i've got my mouse um so gemini we've got all the pieces down here and if you ever need to upgrade your packages you just do pip install the same package again and put the upgrade flag so you can do the same thing with an external repository um as you can see i've got those version of pandas and i could do this with gemini if someone made a change to the master branch you could upgrade that one [Music] okay so that was a very quick look at pycharm at getting python on your machine if i've missed anything please let me know in the comments down below i'm very happy to answer all of your questions so i made this video off the back of a comment from francisco f-e-u-p f-e-u-p f-e-u-p f-e-u-p boom one take gang by the way bro what does feup stand for so if you have anything else you'd like me to cover please let me know in the comments i'm very open to making these kind of videos that help you get started help you get set up so you can move on to those projects that i've set up except ultimately i hope you learned something from this i really want to help you learn something so please let me know how i can help you learn more i'm very open to it and yeah i hope you're looking forward to the next videos let's go baby we back baby one of my friends said i dressed too much like a wall in my last video so blacktops only from now on all right thank you very much i'll see you next time i've been liam hartley let's go
Info
Channel: datadrivendecisions
Views: 12,107
Rating: undefined out of 5
Keywords:
Id: p5gLsod4mug
Channel Id: undefined
Length: 13min 8sec (788 seconds)
Published: Wed Apr 21 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.