Centos 6.4 安装Python 2.7 python-pip的详细步骤
Python  /  管理员 发布于 7年前   200
1. 准备工作
下载源码包
wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
查看是否安装make工具
~#rpm -qa|grep makeautomake-1.11.1-4.el6.noarchmake-3.81-20.el6.x86_64
如果没有安装make工具
yum -y install gcc automake autoconf libtool make
查看是否安装zlib库
~#rpm -qa|grep zlibzlib-devel-1.2.3-29.el6.x86_64zlib-1.2.3-29.el6.x86_64
安装zlib
yum install zlib-devel
检查是否安装ssl 库
~#rpm -qa|grep opensslopenssl-devel-1.0.1e-16.el6_5.x86_64openssl-static-1.0.1e-16.el6_5.x86_64openssl098e-0.9.8e-17.el6.centos.2.x86_64openssl-1.0.1e-16.el6_5.x86_64openssl-perl-1.0.1e-16.el6_5.x86_64
安装openssl
yum install openssl*
安装bzip2依赖库
yum install -y bzip2*
2. 编译安装
cp Python-2.7.3.tar.bz2 /usr/src/tar -jxvf Python-2.7.3.tar.bz2vi Modules/Setup.dist
找到
#SSL=/usr/local/ssl#_ssl _ssl.c \# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \# -L$(SSL)/lib -lssl -lcrypto......#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
把注释去掉
编译
./configure --prefix=/usr/local/python2.7make all make installmake cleanmake distclean
安装成功
~#/usr/local/python2.7/bin/python2.7Python 2.7.3 (default, Dec 18 2013, 15:43:35) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>>
cd /usr/local/python2.7python setup.py install
建立python2.7 软链
~#mv /usr/bin/python /usr/bin/python.bak~#ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python2.7~#ln -s /usr/bin/python2.7 /usr/bin/python
3. 解决yum无法使用的问题
~#yum updateThere was a problem importing one of the Python modulesrequired to run yum. The error leading to this problem was: No module named yumPlease install a package which provides this module, orverify that the module is installed correctly.It's possible that the above module doesn't match thecurrent version of Python, which is:2.7.3 (default, Dec 18 2013, 15:43:35) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]If you cannot solve this problem yourself, please go to the yum faq at: http://yum.baseurl.org/wiki/Faq
因为centos 6.4 下yum默认使用的是python2.6
vi /usr/bin/yum----------------------------------------------------#!/usr/bin/pythonimport systry: import yumexcept ImportError:.......
修改为
#!/usr/bin/python2.6........
4. 安装python-pip工具
先安装setup-tools
wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg --no-check-certificatechmod +x setuptools-0.6c11-py2.7.eggsh setuptools-0.6c11-py2.7.egg
安装pip
wget https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz --no-check-certificatecp pip-1.3.1.tar.gz /usr/src/tar zxvf pip-1.3.1.tar.gzcd pip-1.3.1python setup.py installln -s /usr/local/python2.7/bin/pip /usr/bin/pip
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号