---
title: "How to install Python and pip on an Ubuntu VPS | StreetHosting"
description: "Install Python 3 and pip on an Ubuntu VPS the right way: with apt, pyenv or virtualenv. Set up isolated environments per project without version conflicts."
url: "https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps"
type: "page"
language: "en-US"
---

VPS · 3 min · Intermediate

Published on Jun 18, 2026 · Updated on Jun 18, 2026

# Install Python and pip on an Ubuntu VPS

Python ships with Ubuntu, but not always in the right version for your project. Learn how to install the version you need with pyenv, create virtual environments and manage packages with pip without breaking the system.

By [Equipe StreetHosting](https://streethosting.com.br/en/autores#equipe-streethosting) · StreetHosting infrastructure and support team

[Linux administration](https://streethosting.com.br/en/guides/topics/linux) [Deploying and running apps](https://streethosting.com.br/en/guides/topics/deploy)

Summarize with:

[](https://chat.openai.com/?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Finstall-python-pip-ubuntu-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "ChatGPT") [](https://claude.ai/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Finstall-python-pip-ubuntu-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Claude") [](https://www.google.com/search?udm=50&aep=11&q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Finstall-python-pip-ubuntu-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Google AI Mode") [](https://x.com/i/grok?text=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Finstall-python-pip-ubuntu-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Grok") [](https://www.perplexity.ai/search/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Finstall-python-pip-ubuntu-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Perplexity")

Share:

[](https://x.com/intent/tweet?text=How%20to%20install%20Python%20and%20pip%20on%20an%20Ubuntu%20VPS&url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Finstall-python-pip-ubuntu-vps "Share on X") [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Finstall-python-pip-ubuntu-vps "Share on Facebook") [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Finstall-python-pip-ubuntu-vps "Share on LinkedIn") [](https://wa.me/?text=How%20to%20install%20Python%20and%20pip%20on%20an%20Ubuntu%20VPS%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Finstall-python-pip-ubuntu-vps "Share on WhatsApp")

For agents: Copy as Markdown [.md](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps.md)

In this guide 5 sections

* [Python on Ubuntu](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#python-ubuntu)
* [Install with apt](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#instalar-apt)
* [Install with pyenv](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#pyenv)
* [Install and use pip](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#pip)
* [Virtual environments](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#virtualenv)

Quick answer

To install Python on an Ubuntu VPS, use `sudo apt install python3 python3-pip python3-venv` for the system version. For specific versions, use **pyenv**. Always create a **virtualenv** for each project before installing packages with pip.

## Python on Ubuntu[](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#python-ubuntu)

Ubuntu already ships with Python 3, but not always in the version your project needs. Before installing anything, check which version is available:

`python3 --version`

Ubuntu 22.04 LTS ships with Python 3.10. Ubuntu 24.04 LTS ships with Python 3.12. If your project needs another version, use pyenv.

## Install with apt[](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#instalar-apt)

To install full Python and the basic tools:

1. Update the package list: `sudo apt update`
2. Install Python, pip and venv: `sudo apt install python3 python3-pip python3-venv -y`
3. Confirm the installation: `python3 --version && pip3 --version`

Always install **python3-venv** along with it. Without it, the `python3 -m venv` command does not work.

## Install with pyenv[](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#pyenv)

pyenv lets you install and manage multiple Python versions on the same VPS. To install pyenv:

1. Install the dependencies: `sudo apt install build-essential libssl-dev libffi-dev libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev -y`
2. Download the pyenv installer: `curl https://pyenv.run | bash`
3. Add pyenv to your PATH in \~/.bashrc or \~/.zshrc and restart the shell.
4. Install a Python version: `pyenv install 3.11.9`
5. Set it as the global version: `pyenv global 3.11.9`

Do not use `pyenv global` if it will overwrite the Python that system tools depend on. Use `pyenv local` inside the project folder to scope it to that directory.

## Install and use pip[](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#pip)

pip is Python's package manager. To install a package:

`pip install package-name`

To install from a requirements.txt file (standard in projects):

`pip install -r requirements.txt`

* `pip list`: lists installed packages
* `pip show name`: details about a package
* `pip uninstall name`: removes a package
* `pip freeze > requirements.txt`: exports the project's dependencies

## Virtual environments[](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#virtualenv)

Creating a virtualenv for each project is an essential best practice in production. It prevents package version conflicts between different projects on the same VPS:

1. Go to the project folder: `cd /home/user/my-project`
2. Create the virtualenv: `python3 -m venv .venv`
3. Activate the environment: `source .venv/bin/activate`
4. Install packages with pip as usual inside the activated environment.
5. To deactivate: `deactivate`

While the environment is active, the prompt changes to show the venv name. All installed packages live inside the project's **.venv** folder, without affecting the system.

To put a Python application behind a proxy, see the guide on [Nginx as a reverse proxy](https://streethosting.com.br/en/guides/vps/nginx-reverse-proxy-vps).

In this guide

* [Python on Ubuntu](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#python-ubuntu)
* [Install with apt](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#instalar-apt)
* [Install with pyenv](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#pyenv)
* [Install and use pip](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#pip)
* [Virtual environments](https://streethosting.com.br/en/guides/vps/install-python-pip-ubuntu-vps#virtualenv)

## Frequently asked questions

Does Ubuntu come with Python installed?

Yes. Ubuntu 22.04 ships with Python 3.10 and Ubuntu 24.04 with Python 3.12. For projects that need another version, use pyenv to install specific versions without overwriting the system Python.

What is the difference between pip and pip3?

On modern Ubuntu both commands point to the Python 3 pip. On older systems, pip could refer to Python 2. When in doubt, use pip3 to make sure you are installing for Python 3.

What is virtualenv and why use it?

Virtualenv creates an isolated Python environment for each project. Each project has its own dependencies without interfering with the others. It is the recommended way to manage Python projects in production.

How do I install a specific Python version?

Use pyenv. With it you can install any Python version and switch between them per directory or globally. It is far more flexible than trying to manage multiple versions through apt.

Next step

See VPS plans

Root VPS in Brazil with NVMe and Anti-DDoS.

[See VPS plans](https://streethosting.com.br/en/vps)

[See Ryzen VPS Ryzen 9 9950X VPS in São Paulo with root access, NVMe and gamer Anti-DDoS.](https://streethosting.com.br/en/vps/ryzen)

## Related guides

[VPS Beginner How to connect to your VPS for the first time via SSH You bought the VPS and received an IP, a user and a password. Now it is time for the first login. Here is how to connect over SSH from any system and what to do in the first few minutes. 3 min Read guide](https://streethosting.com.br/en/guides/vps/connect-to-vps-via-ssh-first-time) [VPS Intermediate How to create a sudo user on a Linux VPS Running as root all the time is risky: one wrong command affects everything. The best practice is to create a regular user with sudo and keep root for when you really need it. 3 min Read guide](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps) [VPS Intermediate How to set up Nginx as a reverse proxy on a VPS Your app runs on an internal port and you want to serve it on a domain with HTTPS. Nginx as a reverse proxy solves that and also brings several apps together in one place. 3 min Read guide](https://streethosting.com.br/en/guides/vps/nginx-reverse-proxy-vps)

[← Back to the Guide Center](https://streethosting.com.br/en/guides)
