Configuring a local Python interpreter in PyCharm | Getting started

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in the previous video we customized the ide pycharm has lots of ways to make it feel like home running python code though means setting up a python interpreter an area where python can be challenging maybe pinecharm can help me set up a project's local python interpreter well let's take a look [Applause] [Music] hi i'm paul everett jetbrains developer advocate and welcome to our pycharm getting started series this getting started series is great but our data shows 80 percent of you won't hear about the new videos because you haven't clicked the subscribe button if you subscribe now you'll get all that goodness delivered right to your doorstep in the previous getting started video we showed pycharm getting configured to match your style themes layouts key maps and more customizations now though it's time to run some code we're going to talk about all the different ways you can configure a local python interpreter in pycharm support for remote interpreters is part of pycharm professional edition only let's start now [Music] when talking about local interpreters pycharm lets you configure it in two main ways you can select and use your system interpreter or you can create a virtual environment using virtualenv or pipim or conda with poetry coming at the end of 2021. you just need to have a python installation already set up on your local machine okay so pycharm lets you select your interpreter in three different points of your journey first you can select your interpreter when you create a new project we already covered how to create a new project but we overlooked the python interpreter configuration so i'll go to new project this is going to be of type flask as you can see here when you create a new project you need to choose between using a new environment or a new interpreter creating a new environment versus associating this project with a previously configured interpreter we'll create a new one the first thing you'll notice then is you need to choose from one of the python packaging managers which one do you want to use pycharm comes with support for virtual m pip m and conda with poetry support being added in 2021.3 let's see how to configure a local interpreter using virtualimp pycharm will automatically identify the location where the virtual m folder will be created you can change it by typing or clicking on the folder browse picker next you need to choose the base interpreter you want to use this new interpreter will be based on an existing one in my case it's python 3.10 you can also choose another base interpreter from the drop-down list or if the interpreter is on your system and doesn't appear in this list you can click the three dots bring up a file picker navigate to the location of the python executable on your system you can leave the next two check boxes unselected to learn more about them visit our documentation pages the link is in the description for this video you can also create a virtual m using pip m uh getting pip installed on your system is an extra step you can go to the website for pip-m scroll down to learn a little bit more about it and follow the instructions for installing pit pimp once set up invisible to pirachar you can select it from the down list same instructions apply about the base interpreter finally you can also create a virtual environment using conda make sure that anaconda or miniconda are downloaded and installed on your computer once i choose conda from the drop down check it the location of the conda executable is correct check to make sure the location where you want the virtual environment to go is correct and check to make sure that the python version that you're looking for is correct the environment will be automatically created within your anaconda installation and that's it you can leave the checkbox unmarked for now and read the documentation for more details we just saw making a new interpreter in the various python standards for doing so yeah it's complicated but once you know all that the other ways will show fit right in [Music] that's how you create a new virtual environment in pycharm when setting up a new project but as i mentioned in the beginning you can also select an existing python project that you haven't opened yet as a pie charm project let's see how to do it back on the new project screen click on previously configured interpreter this prompts you with a drop down behind the scenes i have created a new interpreter and shared it with all projects it's called getting started if you don't see the interpreter listed that you're looking for you see no interpreter you can click on the three dots and then make a new interpreter from any of the options that you see here such as conda or pipim that's a look at setting up an existing project interpreter for a new project you can also configure remote interpreters but this is the subject of our next video feel free to jump there if that's what you're looking for [Music] okay enough about creating new projects the second place you can configure interpreter is when you clone a project from vcs i have a django project in my github it's a repository that has a requirements.txt file with the two python packages that need to be installed to make this project work back in pycharm on the getting started screen i clicked on the get from version control button and here i can paste the url to that git repository and accept the directory location that i want this project to be cloned into and then once i'm ready do the clone directly from inside the ide patch arm will then open a new window with a new project with everything cloned from that url and all the software will be installed based on the requirements in the requirements.txt and it will offer to create a new interpreter for me associated with this project in the location that i want the virtual environment to go into and with the packages specified in requirements.txt as you can see cloning a remote repository is easy from the welcome screen pycharm does the cloning for you and then does some of the manual setup work one last case to cover changing the interpreter of an existing project we have a cloned project open and pycharm has a project interpreter for it but what if we want to change the interpreter used by a project let's take a look now as you can see in the bottom right of my screen this project is using a python 3.10 interpreter in the django under tutorial virtual environment we have two ways we can change this for an opened project you can click the interpreter name in the status bar widget here this will open a list of available interpreters and it will also give you the opportunity to either open the interpreter settings or from right here add a new interpreter i usually use the shortcut but you can also find these settings in your preferences or settings under project interpreter right here you can select either an existing interpreter from this drop-down and we see some of the interpreters that this pycharm installation knows about you can also click the gear icon which gives you the option to add new interpreters or show all the interpreters that this pie charm knows about that's it we just went through configuring local python interpreters in pycharm i hope this was useful for you but if you still have questions ask them in the comments in the next episode we'll see how to configure remote interpreters in pycharm so make sure to hit the subscribe button and subscribe to our channel so you won't miss any future updates [Music] you
Info
Channel: PyCharm, a JetBrains IDE
Views: 74,531
Rating: undefined out of 5
Keywords: pycharm, python ide, pipenv, conda, virtualenv, python, pycharm interpreter setup, python interpreter pycharm, pycharm python interpreter setup, how to add python interpreter in pycharm, pycharm python tutorial, python tutorial, pycharm tutorial for beginners, pycharm setup, pycharm tutorial, configure python interpreter in pycharm, pycharm python tutorial installation, pycharm interpreter setup windows 10, Programming, Learn programming, Learn PyCharm, How to Use Pycharm
Id: GTtpypvLoeY
Channel Id: undefined
Length: 9min 34sec (574 seconds)
Published: Mon Dec 06 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.