Skip to content

Instantly share code, notes, and snippets.

@lonsty
Created June 8, 2020 11:31
Show Gist options
  • Save lonsty/24b3d01bed2d2e8d9987d89eaeefdf33 to your computer and use it in GitHub Desktop.
Save lonsty/24b3d01bed2d2e8d9987d89eaeefdf33 to your computer and use it in GitHub Desktop.
PIP install package and save to requirements.txt
#!/bin/bash
pip_install_save() {
package_name=$1
requirements_file=$2
if [[ -z $requirements_file ]]
then
requirements_file='./requirements.txt'
fi
pip install && pip freeze | grep -i $package_name >> $requirements_file
}
pip_install_save $1 $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment