我有一个Python虚拟环境,旨在为很多人提供一个环境。
这种方法是否健全?当多个人在多个目录中使用它时,是否可能存在问题?存档方式我这样做是个好主意吗?对于我所表达的任何想法,是否有更好的方法?
我使用的具体程序如下:
ssh "${USER}"@sern.ch
setupSALTAEnvironment
echo "create Python virtual environment"
virtual_environment_name="virtual_environment"
virtualenv "${virtual_environment_name}"
echo "make activation dynamic"
activate_filename="virtual_environment/bin/activate"
temporary_filename="/tmp/"$(date "+%Y-%m-%dT%H%MZ" --utc)""
cat > "${temporary_filename}" << "EOF"
directory_bin="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
directory_env="$(dirname "${directory_bin}")"
VIRTUAL_ENV="${directory_env}"
EOF
sed -i "/^VIRTUAL_ENV.*/ {
r ${temporary_filename}
d
}" "${activate_filename}"
rm "${temporary_filename}"
echo "activate Python virtual environment"
source "${virtual_environment_name}"/bin/activate
IFS= read -d '' text << "EOF"
import sys
reload(sys)
sys.setdefaultencoding("utf8")
EOF
echo "${text}" > "${virtual_environment_name}"/lib/python2.7/site-packages/sitecustomize.py
echo "install software in Python virtual environment"
pip install docopt
pip install dataset
pip install numpy
pip install matplotlib
pip install pyfiglet
pip install datavision
pip install nodemaster
pip install propyte
pip install git+https://github.com/wdbm/pyprel.git
pip install git+https://github.com/wdbm/pyrecon.git
pip install shijian
pip install technicolor
#pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
#pip install git+git://github.com/google/skflow.git
echo "make Python virtual environment relocatable"
virtualenv --relocatable virtual_environment
echo "archive Python virtual environment with respect to SVN limitations"
tar -czf - virtual_environment/ | split --bytes=50MB - virtual_environment.tgz.
rm -rf virtual_environment