How to Install Virtual Environments on Ubuntu 24.04 VPS Server

How to Install Virtual Environments on Ubuntu 24.04 VPS Server

  • 07 Mar, 2025
  • Technology
Install Virtual Environments on Ubuntu 24.04

Note: Change user to root user (If you are not already in root user by using the below command)

sudo -s


1. Update the system's package list and upgrade installed packages

sudo apt update && sudo apt upgrade -y


2. Install Python 3 and the pip package manager

sudo apt install python3 python3-pip -y


3. Create Directory

mkdir mypythonproj


4. Change Directory

cd mypythonproj


5. Installs the Python Virtual Environment (venv)

sudo apt install python3-venv -y


6. Create virtual environment

python3 -m venv myaivenv

Note: The name of Virtual Environment is myaivenv


7. Active virtual environment

Command - source myaivenv/bin/activate


8. Installing Package with pip

pip install pypdf