Skip to content

Instantly share code, notes, and snippets.

@c-bata
Created May 1, 2014 01:01
Show Gist options
  • Save c-bata/6b6b68e3d6527380df5f to your computer and use it in GitHub Desktop.
Save c-bata/6b6b68e3d6527380df5f to your computer and use it in GitHub Desktop.
複数のvirtualenv環境構築とpipインストールを自動化するシェルスクリプト
numpy
scipy
matplotlib
pandas
scikit-learn
rpy2
nltk
patsy
statsmodels
ipython
nose
pudb
pytest
sphinx
Flask==0.10.1
Flask-GoogleAuth==0.4.2
Flask-SQLAlchemy==1.0
Flask-WTF==0.8.4
Jinja2==2.7.2
SQLAlchemy==0.9.3
WTForms==1.0.5
pymongo==2.6.3
sqlalchemy-migrate==0.9
Flask
Jinja2
Werkzeug
gunicorn
flask-sqlalchemy
psycopg
#!/bin/bash
#===================================================
# 準備
#===================================================
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
fi
askYesOrNo(){
while true; do
read -p "$1 (y/N)?" answer
case $answer in
[yY] | [yY]es | YES )
return 0;;
[nN] | [nN]o | NO )
return 1;;
* ) echo "Please answer yes or no.";;
esac
done
}
#===================================================
# pip install
#===================================================
for name in `ls ~/piplist/*.txt`
do
askYesOrNo "${name%.txt}をインストールしますか?"
if [ $? -eq 0 ]; then
mkvirtualenv ${name%.txt} --python=`which python2.7`
workon ${name%.txt}
pip install -r $HOME/piplist/$name
deactivate
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment