15 Star 32 Fork 10

乞丐亦异/kubernetes-rook-nexus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
create_python_venv.sh 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
乞丐亦异 提交于 2019-11-06 11:16 . rebased
#!/usr/bin/env bash
python_version="python2.7"
venv_dir="python_venv"
if [[ ! $(which virtualenv) ]]; then
echo ""
echo "### Couldn't find 'virtualenv' command, trying to install it..."
echo ""
sudo yum install -y epel-release && \
sudo yum install -y python-virtualenv libselinux-python || \
sudo apt-get install -y virtualenv
fi
if [[ ! $(which pip) ]]; then
echo ""
echo "### Couldn't find 'pip' command, trying to install it..."
echo ""
wget https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py || curl -SL https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
sudo python /tmp/get-pip.py -i https://pypi.doubanio.com/simple
fi
echo ""
echo "### Creating virtualenv virtual environment..."
echo ""
virtualenv --clear python_venv
echo ""
echo "### Copy /usr/lib64/$python_version/site-packages/selinux ./$venv_dir/lib65/python/site-packages/"
echo ""
cp -R /usr/lib64/$python_version/site-packages/selinux ./$venv_dir/lib64/$python_version/site-packages/
echo ""
echo "### Activating virtualenv..."
echo ""
source ./$venv_dir/bin/activate
echo ""
echo "### Installing python packages..."
echo ""
pip install -i https://pypi.doubanio.com/simple wheel
pip install -i https://pypi.doubanio.com/simple -r ./kubespray/requirements.txt
if [[ $? -eq 0 ]]; then
echo "### Python virtual environment is ready."
echo ""
echo "#######################################################################"
echo "### Please run 'source ./$venv_dir/bin/activate' to activate it."
echo "### 请运行 'source ./$venv_dir/bin/activate' 激活 Python 独立环境."
echo "#######################################################################"
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/bottlelee/kubernetes-rook-nexus.git
git@gitee.com:bottlelee/kubernetes-rook-nexus.git
bottlelee
kubernetes-rook-nexus
kubernetes-rook-nexus
master

搜索帮助