89. Virtual Environments with venv
1. Creating a Virtual Environment
# Create a virtual environment named 'myenv'
python -m venv myenv2. Activating a Virtual Environment on macOS/Linux
# Activate the virtual environment
source myenv/bin/activate3. Activating a Virtual Environment on Windows
# Activate the virtual environment on Windows
myenv\Scripts\activate4. Deactivating a Virtual Environment
# Deactivate the virtual environment
deactivate5. Installing Packages in a Virtual Environment
6. Checking Installed Packages in a Virtual Environment
7. Creating a Virtual Environment with Specific Python Version
8. Freezing Dependencies into a Requirements File
9. Installing Dependencies from a Requirements File
10. Verifying Python Version in Virtual Environment
Last updated