Created
June 8, 2020 11:31
-
-
Save lonsty/24b3d01bed2d2e8d9987d89eaeefdf33 to your computer and use it in GitHub Desktop.
PIP install package and save to requirements.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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