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

VIRTUAL ENVIRONMENT

Activating

Activating a Virtual Environment in Django

Once a virtual environment is created, you need to activate it to use the isolated dependencies for your Django project. This guide covers how to activate the virtual environment on different operating systems.

Activating the Virtual Environment on Windows

To activate your virtual environment on Windows, navigate to the folder where it was created, then run:

myenv\Scripts\activate

You should see (myenv) in your terminal, indicating the virtual environment is active.

Activating the Virtual Environment on macOS and Linux

For macOS and Linux users, activation is slightly different. Use the following command:

source myenv/bin/activate

This will also change your prompt to (myenv), indicating the environment is activated.

Deactivating the Virtual Environment

To deactivate the environment once you're done, simply type:

deactivate

This will return you to the global Python environment.

Conclusion

After activating your virtual environment, you can start working on your Django project with isolated dependencies. Learn more about managing your virtual environment 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.