How to Delete virtualenv in Python : Only 2 Steps

In python, you do most of the code in a custom-created virtual environment for a specific project. It makes the other projects separate from the other. All the modules installed in the virtual v bucks generator environment will not have effects on the other virtual environments. Let’s say you have already created a virtual environment for python then how you can delete that virtual environment? In this entire post, you will learn how to Delete virtualenv in python with steps.

How to create a VirtualEnv in python

Before going to the deletion part let’s first know how you can create a virtual environment in python. You can create a virtual environment using the py command.

Go to your path of the directory and Open your terminal. After that run the below command to create virtualenv in python.

py -m venv env

It will create a virtual environment for the name env. After that, you have to activate it to use this virtual environment.

.envScriptsactivate

Now you will see the ( env ) before the path in the terminal.

Activating virtual environment
Activating virtual environment

You can also know the path of the virtual environment using the below command. It will list out all the paths of the python installed in your system.

where python

How to Delete virtualenv (Virtual Environment ) in python

The above part was for the creation of a virtual environment in python. In v bucks generator this section, you will know the various solution to delete virtualenv in python.

Step 1: Deactivate the virtual environment

The first step before deleting virtualenv is to deactivate the environment you have created. To do you have to use the deactivate command.

Type the below command to deactivate venv.

deactivate

Now you will not see the (env) before the directory path. It means the virtual environment is deleted.

(env) C:UsersskrsuDownloadscodethebest>deactivate
C:UsersskrsuDownloadscodethebest>

Step 2: Delete the venv directory

After deactivating the virtualenv now remove the directory that were containing all the files after the creation of the env environment.

Run the below line of code to remove the directory.

rm -rf env

Conclusion

Creation of the virtualenv is very simple but the deletion can take much time if you do not know how to perform it. The above steps will help you to delete virtualenv in python.

I hope this tutorial has helped you to achieve the task that you want. If you have any queries then you can contact us for help.

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

Source link