
I got here by using change directory to my documents folder, analysed the contents of the directory using dir and then used change directory again to set the path equal to the PythonVirtual Environment folder (this was created in my Documents folder). This changes directory (cd) and will allow you to specify which directory you need to change it to:Ģ. To change directory to the project folder, in command prompt, we will use the cd command.Changing directory to our Python project folder Now we need to navigate to the folder we are going to be working with for our Python project.
Getting familiar with Windows Command Prompt
Installing packages into the new virtual environment. Getting VS code to recognise the new virtual environment. Installing a virtual environment via Windows Command Prompt, would work the same way in Windows Powershell. If this sounds like something you would like to do in your projects, then let’s get going, as the following sections and sub-sections will take you through: The only downside might be space on your machine, as potentially you could be doubling up with installs. Your main python package directory does not get FLOODED with unnecessary python packages. You can organize your packages much better, and know exactly the packages you need to run your code, in case someone else needs to run it on their machine. You can use any version of python you want for a specific environment without having to worry about collisions. what are virtual environments:Ī virtual environment is a Python environment such that the Python interpreter, libraries and scripts installed into it are isolated from those installed in other virtual environments, and (by default) any libraries installed in a “system” Python, i.e., one which is installed as part of your operating system Python Website Definition
So, what are the benefits of creating virtual environments.”įirst of all. I thought “I’ll write a blog post on this”. I had a similar problem recently, and then a request came through from a close friend ( Chris Mainey) for the same purpose.