×
   ❮   
PYTHON FOR DJANGO DJANGO FOR BEGINNERS DJANGO SPECIFICS PAYMENT INTEGRATION Roadmap
     ❯   

VIRTUAL ENVIRONMENT

Deactivating

Deactivating a Virtual Environment

Once you've completed your work in a virtual environment, it's important to deactivate it properly. This ensures your global Python environment isn’t affected by any changes made inside the virtual environment.

How to Deactivate a Virtual Environment

To deactivate a virtual environment, regardless of the operating system, run the following command in your terminal:

deactivate

This command exits the virtual environment and reverts your terminal to the system-wide Python installation.

What Happens When You Deactivate?

  • The environment variables specific to your virtual environment are reset.
  • Your terminal returns to its default state, using the global Python installation.
  • Your prompt no longer shows the (myenv) tag.

Reactivating a Virtual Environment

If you want to return to your virtual environment, simply use the appropriate activate command for your OS:

  • Windows: myenv\Scripts\activate
  • macOS/Linux: source myenv/bin/activate

Conclusion

Deactivating your virtual environment is a simple process but critical to managing your project environments effectively. Now, let’s move on to managing dependencies using requirements.txt in the next subtopic.


Django-tutorial.dev is dedicated to providing beginner-friendly tutorials on Django development. Examples are simplified to enhance readability and ease of learning. Tutorials, references, and examples are continuously reviewed to ensure accuracy, but we cannot guarantee complete correctness of all content. By using Django-tutorial.dev, you agree to have read and accepted our terms of use , cookie policy and privacy policy.

© 2024 Nischal Lamichhane. All Rights Reserved.
Django-tutorial.dev is styled using Bootstrap 5.
And W3.CSS.