CentOS 6编译安装python 3.6.1,centos3.6.1,Python官网:h
CentOS 6编译安装python 3.6.1,centos3.6.1,Python官网:h
Python官网:https://www.python.org/
一、查看CentOS版本和系统默认Python版本:
# cat /etc/redhat-release
# python -V
二、编译安装Python-3.6.1:
1、安装依赖软件包:
# yum -y groupinstall "Development tools"
# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-develreadline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
2、设置CentOS6当前系统时间:
# date 040413022017.30
# date
3、编译安装Python-3.6.1:
# tar xf Python-3.6.1.tar.xz -C /usr/src
# cd /usr/src/Python-3.6.1
# ./configure --prefix=/usr/local/python3.6.1 --enable-shared --enable-profiling--enable-optimizations --disable-ipv6 --with-threads --with-pymalloc --with-fpectl--enable-loadable-sqlite-extensions
# make && make install //此步骤过程中需要执行测试,用时较长
4、更改CentOS6默认Python版本为3.6.1:
# mv /usr/bin/python /usr/bin/python2.6.6-old
# ln -s /usr/local/python3.6.1/bin/python3 /usr/bin/python
5、添加至PATH环境变量:
# vim /etc/profile.d/python3.6.1.sh
exportPATH=/usr/local/python3.6.1/bin:$PATH
# . /etc/profile.d/python3.6.1.sh
# echo $PATH
6、配置头文件:
# ln -sv /usr/local/python3.6.1/include /usr/include/python3.6
7、配置库文件:
# echo "/usr/local/python3.6.1/lib" >/etc/ld.so.conf.d/python3.6.1.conf
# cat /etc/ld.so.conf.d/python3.6.1.conf
# ldconfig
8、配置man帮助文档:
# vim /etc/man.config,新增如下代码:
MANPATH /usr/local/python3.6.1/share/man
9、查看配置后的Python版本:
# python -V
# python3 -V
三、将yum中的Python版本修改为系统原来的2.6.6版本:
升级Python后会导致yum无法使用:
# vim /usr/bin/yum,将第一行的“#!/usr/bin/python”修改为“#!/usr/bin/python2.6.6-old”
本文出自 “天道酬勤” 博客,请务必保留此出处http://qiuyue.blog.51cto.com/1246073/1912806
CentOS 6编译安装python 3.6.1
相关内容
- 如何在同一台电脑(windows系统)上同时搭建python2和p
- Python3.x:SQLAlchemy操作数据库,,Python3.x:
- Python架构师手把手教你Scrapy 对接 Docker,scrapydocker,环境
- 从0开始学Python,0基础小白,python小白,Python3学习第
- python中异常处理,python异常处理,什么是异常?异常是一
- python安装,,Python是一种面
- Python3 replace()函数使用方法,python3replace
- python3学习笔记之多进程分布式小例子,python3学习笔记
- CentOS下Python3的安装及创建虚拟环境的方法,centospytho
- python3实现名片管理系统,
评论关闭