This gist describes how to bundle a pip installation and install it on a host with no access to the pip registry. This example uses the pip package power-user-tools
.
mkdir ./bundle
cd bundle
python3 -m pip download --platform linux power-user-tools
cd ..
tar cvzf put.tar.gz bundle
tar xvzf put.tar.gz
cd bundle
python3 -m pip install --no-index --find-links . power-user-tools
cd .local/bin
sed -i 's,#!/usr/local/bin/python,#!/usr/bin/env python3,' $(grep -l '#!/usr/local/bin/python' * | xargs)