$ deactivate
To deactivate a virtual environment in Python, you can use the deactivate command. This is a shell command, not a Python command, so you'll need to run it from the command line or terminal. After running this command, you should see the command prompt change, indicating that you are no longer in the virtual environment.
Alternatively, you can also use the exit command to exit the virtual environment. This will also close the terminal window or exit the command prompt, depending on your operating system.
$ exitIf you are using a Python shell or interactive interpreter, you can simply close the window or exit the interpreter to deactivate the virtual environment.
It's also worth noting that if you are using a Python script to manage your virtual environments, you can use the exit() function to exit the script and deactivate the virtual environment.
import sys sys.exit()
Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.