一、检查看依赖环境是否安装
gcc –v gcc是最基本的开发库,gcc –v 查询gcc的版本,如果有以下信息证明了gcc已安装,如果出现“command not found”证明没有安装,需要通过yum去安装,命令如下: yumgroupinstall "Development Tools" yum install zlib yum install zlib-devel
安装所有的开发工具,安装后,再用gcc –v 是否安装成功。 安装openssl yum install openssl* -y
二、python安装 tar zxvf Python-2.7.6.tgz cd Python-2.7.6 编译: ./configure --prefix=/opt/python2.7.6 --enable-shared 由于python目前全面强制支持ssl,因此需要修改
#修改Setup文件
vi Python-2.7.6/Modules/Setup
#修改结果如下:
#Socket module helper for socket(2)
_socket socketmodule.ctimemodule.c
#Socket module helper for SSL support; you must comment out the other
#socket line above, and possibly edit the SSL variable:****
#SSL=/usr/local/ssl
_ssl _ssl.c
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl
-L$(SSL)/lib -lssl -lcrypto
make &&make install
mv /usr/bin/python /usr/bin/python.2.6.6 vim /usr/bin/yum,修改第一行为#!/usr/bin/python2.6.6,避免以后yum使用报错。 ln -s /opt/python2.7.6/bin/python /usr/bin/python ln -s /opt/python2.7.6/bin/python2.7 /usr/bin/python2.7 ln -s /opt/python2.7.6/lib/libpython2.7.so /lib64/libpython2.7.so ln -s /opt/python2.7.6/lib/libpython2.7.so.1.0 /lib64/libpython2.7.so.1.0
至此安装完成、可以手动验证一下~
安装python扩展程序 安装setuptools wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz tar xf setuptools-1.4.2.tar.gz cd setuptools-1.4.2 /opt/python2.7.6/bin/python setup.py install
安装pip 去下载pip https://pypi.python.org/simple/pip/ \复制里面pip9.01的链接 wget --no-check-certificate https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9 tar xf pip-9.0.1.tar.gz cd pip-9.0.1 /opt/python2.7.6/bin/python setup.py install 做软连接 ln -s /opt/python2.7.6/bin/pip /usr/bin/pip
/opt/python2.7.6/bin/pip install urllib3 /opt/python2.7.6/bin/pip install requests /opt/python2.7.6/bin/pip install threadpool /opt/python2.7.6/bin/pip install pyOpenssl
安装 supervisor /opt/python2.7.6/bin/pip install supervisor ln -s /opt/python2.7.6/bin/supervisorctl /usr/bin/supervisorctl ln -s /opt/python2.7.6/bin/supervisord /usr/bin/supervisord 启动 supervisord /opt/python2.7.6/bin/supervisord -c /etc/supervisord.conf