Activate and Deactivate Your Virtual Environment

All commands you need to remember for the creation, activation, and deactivation of Virtual Environment on mac

Open your terminal:

  1. Firstly check if you have virtualenv installed.

If you already have, it will give you this:

If you don't have, get it by:

2. Create a folder for your virtual environments, where you want on your machine:

3. Make directory for the current project there, which you gonna start:

4. Start virtual environment, it will generate some files in your folder.

If it says:

Then you have to execute virtualenv package from its location. You can get your virtualenv location from running pip3 show virtualenv.

Now, you have to run this command by giving your virtualenv package location.

5. Move into the project directory, that you created above.

6. Activate your VE by:

8. You can confirm which python your VE is using by:

9. After working, deactivate using:

Create requirenment.txt file in your VE:

To create requirenment.txt file in your VE.

To install all dependencies present in requirnment.txt file.

Create your new python file in VE folder:

And run it by:

Thats all you need.

Happy Coding!

Learner.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store