×
   ❮   
PYTHON FOR DJANGO DJANGO FOR BEGINNERS DJANGO SPECIFICS 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.