代码拉取完成,页面将自动刷新
#!/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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。