In this post we will look at how to set up a virtual environment in python.
The folder that we will use will be a project folder for a upcoming project we can build and use the virtual environment to contain the libraries we will need to make it work.
You can create a directory for this project any where you like but for this example we can use the home directory.
Start with creating a folder. Open the terminal and from the home directory enter the command:
1
mkdir 'name_your_folder'
After the folder in made you will change directory into the folder. Use the following command.
1
cd 'name_of_your_folder
Once you are in the directory of the folder you created run this command.
1
python3 -m venv venv
Now you can activate the environment.
1
source venv/bin/activate