微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CentOS python2.6.6 升级 2.7.5 并安装pip, apscheduler

1.查看当前python版本
# python -V
Python 2.6.6 (r266:84292,Jul 23 2015,15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help","copyright","credits" or "license" for more information.


2.下载python2.7.5
# wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2


3.解压
#tar -jxvf Python-2.7.5.tar.bz2


4.配置SSL

# sudo yum install openssl-devel // 如果没有https,需要安装
#cd Python-2.7.5/Modules
# vi Setup.dist
找到:
# 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
改为:
# 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


5.安装python2.7.5
#cd ..
#./configure
#make all
#make install
#make clean
#make distclean


6.建立软连接,使系统认的 python指向 python2.7
#mv /usr/bin/python /usr/bin/python2.6.6
#ln -s /usr/local/bin/python2.7 /usr/bin/python


7.解决系统 Python 软链接指向 Python2.7 版本后,因为yum是不兼容 Python 2.7的,所以yum不能正常工作,我们需要指定 yum 的Python版本
#vi /usr/bin/yum
文件头部的
#!/usr/bin/python
改成
#!/usr/bin/python2.6.6

8.安装easy_install
#wget -q http://peak.telecommunity.com/dist/ez_setup.py
#python ez_setup.py


9.安装python包管理安装工具pip
#wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz
#tar zvxf 1.5.5.tar.gz #解压文件
#cd pip-1.5.5/
#python setup.py install

10. 安装APSchedule

#easy_installapscheduler

报错:

ImportError: <module 'setuptools.dist' from '/usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.pyc'> has no 'check_specifier' attribute


百度不行,google, 终于找到了解决方

$ sudo pip install setuptools --upgrade

然后再次执行 #easy_installapscheduler 成功

原文地址:https://www.jb51.cc/centos/377093.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。