In this guide, we will look at how to  Install pip Python package manager on FreeBSD 12. pip is a package management system used to install and manage software packages written in Python.

There are two ways you can install pip on FreeBSD system. I have FreeBSD 12 installed on my Laptop:

# freebsd-version

FreeBSD 12 comes with both Python2.7 and Python3.6.

# python
python2.7         python2.7-config  python3.6         python3.6-config  python3.6m        python3.6m-config

The default version I’m using is 3.6. Note that python command is not available on FreeBSD 12.

# which python
python: Command not found

You can create a symbolic link of Python3.6 binary to /usr/local/bin/python

# ln -s /usr/local/bin/python3.6 /usr/local/bin/python
# python --version
Python 3.6.6

Install Pip from py36-pip package:

# pkg install py36-pip
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	py36-pip: 9.0.3
	py36-setuptools: 40.0.0

Number of packages to be installed: 2

The process will require 21 MiB more space.
6 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/2] Fetching py36-pip-9.0.3.txz: 100%    6 MiB 308.7kB/s    00:20    
[2/2] Fetching py36-setuptools-40.0.0.txz: 100%  487 KiB 124.6kB/s    00:04    
Checking integrity... done (0 conflicting)
[1/2] Installing py36-setuptools-40.0.0...
[1/2] Extracting py36-setuptools-40.0.0: 100%
[2/2] Installing py36-pip-9.0.3...
[2/2] Extracting py36-pip-9.0.3: 100%
Message from py36-setuptools-40.0.0:


  Only /usr/local/bin/easy_install-3.6 script has been installed
  since Python 3.6 is not the default Python version.

Message from py36-pip-9.0.3:

============================== !!!! WARNING !!!! ==========================

pip MUST ONLY be used:

 * With the --user flag, OR
 * To install or manage Python packages in virtual environments

Failure to follow this warning can and will result in an inconsistent
system-wide Python environment (LOCALBASE/lib/pythonX.Y/site-packages) and
cause errors.

Avoid using pip as root unless you know what you're doing.

============================== !!!! WARNING !!!! ==========================

Create a symbolic link for Pip-3.6 package:

# which pip-3.6
# ln -s /usr/local/bin/pip-3.6 /usr/local/bin/pip
# pip --version 
pip 9.0.3 from /usr/local/lib/python3.6/site-packages (python 3.6)

Upgrade pip:

# pip install --upgrade pip
Collecting pip
  Downloading (1.3MB)
    100% |################################| 1.3MB 750kB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-18.1

Test pip usage

$ pip install awscli --user

If you install Python packages with Pip as a normal user, the binary is placed under .local/bin/

Add the Path to your PATH variable.

$ vim ~/.bashrc
export PATH=$PATH:.local/bin/

If you want to install Pip for Python 2.7, run:

# pkg install py27-pip

You should now have PIP Python package manager installed on FreeBSD 12.

Similar articles:

How to install Pip3 & Django on Ubuntu 18.04 / Ubuntu 16.04 LTS

Install Pip on Debian 10 (Buster) Linux

How to Install Python 3 / Python 2.7 on RHEL 8

How to Install Python 3.6 on Ubuntu 16.04 / CentOS 7 / Debian 9 / macOS