Looking to manage Python dependencies without messing up your Ubuntu system? 🐍📦
In this DelftStack tutorial, we show you how to create, activate, and deactivate a Python virtual environment (venv) on Ubuntu. Virtual environments are crucial for developers because they allow you to keep project-specific libraries isolated from the global Python installation. We'll guide you through installing the necessary python3-venv package, creating your first environment, and verifying that it's active.
🔹 What You'll Learn in This Video:
✅ Installing the python3-venv package using apt.
✅ Creating a new virtual environment with python3 -m venv.
✅ Activating the environment using the source command.
✅ Recognizing the active state (looking for the parenthesis prompt).
✅ Deactivating the environment to return to the system Python.
💻 Commands Used in This Tutorial:
• Update package list: sudo apt update
• Install venv tool: sudo apt install python3-venv -y
• Create virtual environment: python3 -m venv my_env
• Activate environment: source my_env/bin/activate
• Deactivate environment: deactivate
📌 Timestamps:
⏱ 00:00 - Introduction
⏱ 00:21 - Start of tutorial
⏱ 02:50 - Conclusion
🔧 Why Watch This Video?
If you've ever encountered "externally-managed-environment" errors or conflicting library versions, using a venv is the solution. It is the standard, best-practice method for Python development on Linux systems.
🔥 Liked the Video? Don't Forget to Subscribe!
If you found this Python setup guide helpful, hit the 👍 button, share it with your fellow coders, and subscribe to our channel for more Linux and programming tutorials. Turn on notifications 🔔 to stay updated!