How To Create Virtual Environment In Python In Current Directory

To activate a virtual environment for Python in the current directory, you can use the virtualenv package. This package allows you to create isolated Python environments, which can be useful for managing dependencies and installing specific versions of packages.

To install virtualenv, you can use the following command:

pip install virtualenv

Once you have installed virtualenv, you can create a new virtual environment in the current directory by running the following command:

virtualenv env

This will create a new directory called env in your current directory, which contains the files and directories for your new virtual environment.

To activate your virtual environment, you can use the following command:

source env/bin/activate

This will modify your shell prompt to indicate that you are now using the virtual environment. You can now use pip to install packages in your virtual environment without affecting the global Python installation.

When you are finished using your virtual environment and want to return to the global Python installation, you can use the deactivate command:


This will return your shell prompt to its normal state and you will no longer be using the virtual environment.

Related Articles

Amazon FBA How To Become a Successful Seller in 2023

This article from DOC EDUCATES is a free guide explaining how to sell on amazon for beginners, mostly explaining FBA (Fulfilled By Amazon) Business model. In this guide, we will cover all the steps needed to sell on Amazon FBA (Fulfilled By Amazon). We will show you how to set up your account, take pictures of your products, list them for sale and manage orders.


Your email address will not be published. Required fields are marked *