How to set up Python virtual environments
Updated 10/16/2026
Python virtual environments isolate each project's packages, so different versions do not clash and you do not affect the system.
1. Install Python and venv
apt-get update -y
apt-get install -y python3 python3-venv python3-pip
2. Create a virtual environment
cd /var/www/project
python3 -m venv venv
3. Activate it
source venv/bin/activate
Now pip install installs packages only in this environment, not system-wide.
4. Install dependencies
pip install -r requirements.txt
5. Leave the environment
deactivate
Multiple Python versions
If you need different Python versions (not just packages), use pyenv, the Python equivalent of nvm.
In production
Run the Python app (for example with Gunicorn) as a persistent service, see how to create a systemd service, behind a reverse proxy.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to send WhatsApp messages from your apps with OpenWA
OpenWA gives you a REST API over WhatsApp, on your own server. Here is how to install it, connect it and send your first message, safely.
Updated 10/16/2026Dev environmentsHow to deploy an app from Git with Openship
From a Git repo to a live app, with a database, domain and SSL, on your own server, with no config files.
Updated 10/16/2026Dev environmentsHow to install PHP (multiple versions) and Composer
Install the PHP version your project needs, along with Composer for package management.
Updated 10/16/2026