准备工作:
1、安装gcc
參考:https://blog.csdn.net/duguduchong/article/details/8699774
yum -y install gcc
2、安装 Wget
yum -y install wget
3、安装 python27-libs
链接:https://repo.saltstack.com/yum/redhat/6.9/x86_64/2018.3/
wget https://repo.saltstack.com/yum/redhat/6.9/x86_64/2018.3/python27-libs-2.7.13-3.ius.el6.x86_64.rpm
yum install -y python27-libs-2.7.13-3.ius.el6.x86_64.rpm
4、安装 python27
wget https://repo.saltstack.com/yum/redhat/6.9/x86_64/2018.3/python27-2.7.13-3.ius.el6.x86_64.rpm
yum install -y python27-2.7.13-3.ius.el6.x86_64.rpm
5、安装 python27-devel
wget https://repo.saltstack.com/yum/redhat/6.9/x86_64/2018.3/python27-devel-2.7.13-3.ius.el6.x86_64.rpm
yum install -y python27-devel-2.7.13-3.ius.el6.x86_64.rpm
6、安装 setuptools
参考:
https://jingyan.baidu.com/article/b907e6278f528946e6891c7a.html
cd /
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar -zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11/
python2.7 setup.py build
python2.7 setup.py install
7、安装 pip
参考:
https://www.cnblogs.com/smail-bao/p/6483759.html
cd /
wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
tar -zxvf pip-9.0.1.tar.gz
cd pip-9.0.1
python2.7 setup.py install
ln -s /usr/local/python2.7.14/bin/pip /usr/bin/pip
8、pip 替换国内镜像
参考:
https://blog.csdn.net/m0_37690319/article/details/79945809
9、安装 virtualenv
cd /
pip install virtualenv -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
mkdir /tiops-client
cd /tiops-client
virtualenv --no-site-packages venv
source venv/bin/activate
10、纯净环境下安装一系列 Python 包
pip install salt -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
pip install scapy -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
pip install docutils -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
pip install python-daemon -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
pip install psutil -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
pip install netifaces -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
11、pip 安装 SaltStack 时,又报 gcc 错误!
这次我安装python-devel了,为什么还会报gcc错。我去网上查,可能是没安装openssl-devel。
而openssl-devel和python版本没啥关系直接安装就是。
参考:
https://www.cnblogs.com/gerrydeng/p/7159021.html
https://blog.csdn.net/learn_tech/article/details/80066583(解决问题)
yum install libffi-devel openssl-devel -y