#!/usr/bin/env bash
# This script follows the steps described in this link:
# https://stackoverflow.com/a/51646354/8808983
LIBRARIES_DIR="python3.6-wheelhouse"
if [ -d ${LIBRARIES_DIR} ]; then
rm -rf ${LIBRARIES_DIR}/*
else
mkdir ${LIBRARIES_DIR}
fi
pip download -r requirements.txt -d ${LIBRARIES_DIR}
files_to_add=("requirements.txt" "install-python-libraries-offline.sh")
for file in "${files_to_add[@]}"; do
echo "Adding file ${file}"
cp "$file" ${LIBRARIES_DIR}
done
tar -cf ${LIBRARIES_DIR}.tar ${LIBRARIES_DIR}
安装端:文件名:"install-python-libraries-offline.sh"
#!/usr/bin/env bash
# This script follows the steps described in this link:
# https://stackoverflow.com/a/51646354/8808983
# This file should run during the installation process from inside the libraries directory, after it was untared:
# pythonX-wheelhouse.tar -> untar -> pythonX-wheelhouse
# |
# |--requirements.txt
# |--install-python-libraries-offline.sh
pip3 install -r requirements.txt --no-index --find-links .