---
title: How to Install Python and Pip on FreeBSD 14.0
url: https://docs.vultr.com/how-to-install-python-and-pip-on-freebsd-14-0
description: Learn how to install Python and Pip on FreeBSD 14.0 with our step-by-step guide. Get your Python development environment up and running quickly and efficiently.
publish_date: 2024-11-15T00:00:00Z
last_updated: 2024-11-15T00:00:00Z
author: Abdelhadi Dyouri
header_image: https://docs.vultr.com/public/doc-assets/2009/ddb8ff8b-4362-4a94-a2a1-9c2699d2aaf1.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

## Introduction

Python is a modern high-level programming language for developing web applications, running artificial intelligence (AI) models, and performing data analysis. Pip, a standard package manager for Python, allows you to install and manage libraries or dependencies in your Python project.

This article explains how to install Pip on FreeBSD 14. You will also install multiple Python versions and create an isolated development environment using the `venv` module.

## Prerequisites

Before you begin:

* Deploy a [FreeBSD 14.0 instance](https://www.vultr.com/servers/freebsd/) on Vultr.
* Access the instance [using SSH](https://docs.vultr.com/how-to-use-ssh-with-vultr-servers) as a non-root user with sudo privileges.
* Update the instance.

## Install Python

The FreeBSD operating system preinstalls Python by default, and you can also pull it from the package repositories using the `pkg` package manager. However, those Python versions might be out of date. Follow the steps below to verify the default Python version and install the latest Python version on your server by building the application from source.

1. View the default Python version.

    ```console
    $ python --version
    ```

    Output:

    ```
    Python 3.11.9
    ```

1. Download the latest Python version release file. For example, version `3.13`. Visit the [Python releases page](https://www.python.org/downloads/) to verify the latest version.

    ```console
    $ wget https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz
    ```

1. Extract all files from the archive.

    ```console
    $ tar -xvzf Python-3.13.0.tgz
    ```

1. Switch to the new Python directory. For example, `Python-3.13.0`.

    ```console
    $ cd Python-3.13.0
    ```

1. Run the `configure` script to initialize the build process.

    ```console
    $ ./configure --with-system-ffi --with-computed-gotos --enable-shared
    ```

1. Use `make` to build Python from source.

    ```console
    $ make -j$(sysctl -n hw.ncpu)
    ```

1. Install Python. The `altinstall` option installs the Python version without overwriting the default version.

    ```console
    $ sudo make altinstall
    ```

1. View the new Python version.

    ```console
    $ python3.13 --version
    ```

    Output:

    ```
    Python 3.13.0
    ```

1. Verify that the default version is available and unchanged.

    ```console
    $ python3 --version
    ```

    Output:

    ```
    Python 3.11.9
    ```

    You have installed the latest Python version on your FreeBSD server.

1. Run the following command to remove the pre-installed version.

    ```console
    $ sudo rm /usr/local/bin/python3    
    ```

1. Allow the `python3` command to use the new version by default.

    ```console    
    $ sudo ln -s /usr/local/bin/python3.13 /usr/local/bin/python3
    ```

## Install PIP on FreeBSD 14

Pip is the standard Python package manager for installing and managing project dependencies. Depending on the running Python version, follow the steps below to verify and install Pip on FreeBSD 14 server.

1. View the default Pip version on your server.

    ```console
    $ pip --version
    ```

    Verify that the command fails with the following output:

    ```
    -su: pip: not found
    ```

1. Download the latest Pip installation script.

    ```console
    $ wget https://bootstrap.pypa.io/get-pip.py
    ```

1. Install a Pip version based on your Python version, such as the Python 3.13 you installed earlier.

    ```console
    $ sudo python3.13 get-pip.py 
    ```

    Output:

    ```
    Collecting pip
      Using cached pip-24.2-py3-none-any.whl.metadata (3.6 kB)
    Using cached pip-24.2-py3-none-any.whl (1.8 MB)
    Installing collected packages: pip
      Attempting uninstall: pip
        Found existing installation: pip 24.2
        Uninstalling pip-24.2:
          Successfully uninstalled pip-24.2
    Successfully installed pip-24.2
    ```

    * Install Pip using the default Python version on your server.

        ```console
        $ sudo python3 get-pip.py 
        ```

1. View the new Pip version.

    ```console
    $ pip3.13 --version
    ```

    Output:

    ```
    pip 24.2 from /usr/local/lib/python3.13/site-packages/pip (python 3.13)
    ```
Find out how to [install pip on ubuntu](https://docs.vultr.com/how-to-install-python-and-pip-on-ubuntu-24-04) to manage Python packages effectively in your development environment.

## Test the Python Package

Follow the steps below to test the Python package on FreeBSD.

1. Access the Python shell.

    ```console
    $ python3.13
    ```

1. Run the following command to display a `Hello World, Greetings from Vultr!` message in your terminal.

    ```python
    >>> print('Hello World, Greetings from Vultr!')
    ```

    Output:

    ```
    Hello World, Greetings from Vultr!
    ```

1. Exit the Python shell.

    ```python
    >>> quit()
    ```

1. Install a new Python module, such as `flask` using Pip.

    ```console
    $ pip3.13 install flask
    ```

    Output:

    ```
    Collecting flask
      Downloading flask-3.0.3-py3-none-any.whl.metadata (3.2 kB)
    Collecting Werkzeug>=3.0.0 (from flask)
      Downloading werkzeug-3.0.4-py3-none-any.whl.metadata (3.7 kB)
    Collecting Jinja2>=3.1.2 (from flask)
      Downloading jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
    Collecting itsdangerous>=2.1.2 (from flask)
    ```

## Install Multiple Python Versions

Multiple projects may require different Python versions on your server. You can install new Python versions using the `pkg` package manager or use a project management tool such as `pyenv` to install and manage multiple Python versions.

1. Update the server's package information index.

    ```console
    $ sudo pkg update
    ```

1. Install the `git` dependency package.

    ```console
    $ sudo pkg install -y git
    ```

1. Install the `pyenv` tool.

    ```console
    $ sudo pkg install -y pyenv
    ```

1. View the available Python versions you can install on your server.

    ```console
    $ pyenv install --list
    ```

    Output:

    ```
    Available versions:
     2.1.3
    .........
     3.9.13
     3.9.14
     3.9.15
    .........
     3.10.10
     3.10.11
    ..........
     3.11.8
     3.11.9
     3.11.10
     3.12.0
     3.12-dev
    .........
     3.12.6
     3.13.0rc2
     3.13.0rc2t
     3.13-dev
     3.13t-dev
     3.14-dev
     3.14t-dev
    .........
    ```

1. Install a specific Python version such as `3.14-dev`.

    ```console
    $ pyenv install 3.14-dev
    ```

1. Install another version, such as `3.12.6`.

    ```console
    $ pyenv install 3.12.6
    ```

1. View all installed Python versions in your environment.

    ```console
    $ pyenv versions
    ```

    Output:

    ```
    * system (set by /home/user/.pyenv/version)
      3.12.6
      3.14-dev
    ```

1. Set a specific Python version as the default in your environment. For instance, `3.12.6`.

    ```console
    $ pyenv global 3.12.6
    ```

1. View the active Python version in your environment.

    ```console
    $ pyenv version
    ```

    Output:

    ```
    3.12.6 (set by /home/user/.pyenv/version)
    ```

## Create a Python Virtual Environment

Python uses the `venv` module to create isolated virtual environments on your server, allowing you to separate specific dependencies in your project from the system-wide Python environment. Follow the steps below to create a new virtual environment using the `venv` module.

1. Create a new `myenv` virtual environment.

    ```console
    $ python3 -m venv myenv
    ```

1. Activate the `myenv` virtual environment.

    ```console
    $ . myenv/bin/activate
    ```

    Verify that your terminal prompt changes and includes the name of the new environment similar to the output below.

    ```console
    (myenv) user@vultr:~ $
    ```

1. View the active `python` binary path.

    ```console
    $ which python3
    ```

    Verify that the Python binary is active in your virtual environment path similar to the output below.

    ```
    /home/user/myenv/bin/python3
    ```

1. Install a Python package such as `requests` using Pip in the new environment.

    ```console
    $ pip install requests
    ```

    Output:

    ```
    Successfully installed certifi-2024.8.30 charset-normalizer-3.4.0 idna-3.10 requests-2.32.3 urllib3-2.2.3
    ```

1. List all available Python modules in the environment.

    ```console
    $ pip freeze
    ```

    Output:

    ```
    certifi==2024.8.30
    charset-normalizer==3.4.0
    idna==3.10
    requests==2.32.3
    urllib3==2.2.3
    ```

1. Exit the virtual environment.

    ```console
    $ deactivate
    ```

## Conclusion

You have installed Pip on FreeBSD 14 along with Python. Additionally, you've installed multiple Python versions to use with different projects and packages on the server. Python supports various tools that can be integrated with other applications, such as database servers, to match your project needs. For further details, please visit the [Python documentation](https://docs.python.org/3/).
