OPENCV – PYTHON | Virtual Environment (window + Ubuntu) INSTALL and USAGE | sys.argv Argument
Python virtual environments are an essential tool for managing project dependencies and isolating different Python projects on your system. In this guide, we will walk through the steps to create and activate virtual environments on both Ubuntu and Windows operating systems.
You can also Refer to the below video explanation for the same task:
Installing Python Virtual Environment on Ubuntu:
Step 1: Install Python and Pip
Ensure that Python and pip are installed on your Ubuntu system. Open a terminal and run the following commands:
sudo apt update
sudo apt install python3 python3-pip
Step 2: Install Virtualenv
Use pip to install the virtualenv package:
pip3 install virtualenv
Step 3: Create a Virtual Environment
Navigate to your project directory in the terminal and create a virtual environment:
mkdir my_project
cd my_project
python3 -m virtualenv venv
Step 4: Activate the Virtual Environment
Activate the virtual environment using the following command:
source venv/bin/activate
Installing Python Virtual Environment on Windows:
Step 1: Install Python and Pip
Download and install Python from the official website: Python Downloads.
Make sure to check the box that says “Add Python to PATH” during installation.
Step 2: Install Virtualenv
Open a command prompt and use pip to install the virtualenv package:
pip install virtualenv
Step 3: Create a Virtual Environment
Navigate to your project directory in the command prompt and create a virtual environment:
mkdir my_project
cd my_project
python -m virtualenv venv
Step 4: Activate the Virtual Environment
Activate the virtual environment with the following command:
venv\Scripts\activate
Conclusion:
Congratulations! You have successfully set up Python virtual environments on both Ubuntu and Windows. These environments provide a clean and isolated space for your Python projects, ensuring that dependencies do not interfere with each other. Remember to activate the virtual environment whenever you work on a specific project to maintain a clean and organized development environment.
Virtual Environment, Python Code, Python Projects, Infoaryan, Aryan Verma, Infoaryan Projects, Venv Python, Virtual Environment Python, Python OpenCV projects, OpenCV Python Projects.