alt text for screen readers

In this post I will show you 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:

mkdir 'name_your_folder'

After the folder in made you will change directory into the folder. Use the following command.

cd 'name_of_your_folder'

Once you are in the directory of the folder you created run this command.

python3 -m venv venv

Now you can activate the environment.

source venv/bin/activate

Now the project folder and virtual environment have been created and you are ready to start your project. When you are ready to leave the project you can simply type deactivate in terminal. The virtual environment will always be available to reactivate from your project folder.