In this post, I’ll demonstrate how to set up a virtual environment in python. It’s quite important to set up a virtual environment when you’ve developing different projects. The package and python version may be different according to the practical request.
In the virtual environment, you can install what you need and it won’t influence any setting outside the virtual environment. So, it’s also a good technique for testing some state-of-the-art things. Okay, let’s start.
First, open your “command line”.
Second, chose a directory.
Let’s take a look at the python environment folder.
Okay, it’s empty now. Let’s create a python environment by python 3.7.
The “-3.7” is the version of python you need to create the version, so you can change it to any version you need. But you need to install it on your computer first. You can find the installation file on the python website. The “.\venv37” is the virtual environment name. You can choose the name that you want.
Let’s take a look at the folder again.
The environment created! Congratulations!
Third, let’s activate the environment. Key in the script then enter.
We’re in a virtual environemnt.
Let’s open the IDLE in this environment.
These are the simple steps to create and activate the python virtual environment. Hope it can help you with your daily work.