Python – the same programming language second graders use to make beetle bots turn left – also offers simple and incredibly powerful code for adults, especially data scientists. These individuals are responsible for automating data-driven processes, using data to predict values, or finding patterns in data that are too complicated to do on brainpower alone.
And the best part? Python can do these things for you while you focus on other, more important tasks.
To get started, you should first create a virtual environment. Think of a virtual environment like your private playground where all of your project work will occur without bumping into other projects. In fact, the main purpose of Python virtual environments is to create separate, isolated areas for each of your Python projects. This means that each project can have its own dependencies, regardless of what dependencies other projects have.
There are two steps to create virtual environments for your Python 3 projects on Windows 10:
Step 1:
To set up the virtual environment, type “Python -M venv” and then the name of the subdirectory that’s going to hold the virtual environment. For this example, let’s use “test”as the name of your virtual environment. Within a couple of seconds, your screen should display the following message:
PS C:\> python -m venv C:\path\to\test
Step 2:
Open your project directory using Visual Studio code. Within that directory, create a new sub directory to store the code for your project. Then create a new Python file. At this point, the Python digit extension will activate and will automatically attempt to detect an existing virtual environment inside your new directory. Now, your prompt will change, and you’ll be inside the virtual environment you just created. You can now install packages in the environment.
Tip:
One of the easiest ways to start a project is with Conda Packages, a cloud-based repository of more than 7,500 data science and machine learning packages. The conda-install command can provide a head start for many projects.