在CentOs服务器上源码安装python3.5

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在CentOs服务器上源码安装python3.5相关的知识,希望对你有一定的参考价值。

                                  在CentOs服务器上源码安装python3.5

                                        作者:尹正杰

1.系统环境介绍

技术分享

2.安装依赖包

[[email protected] packages]# yum -y groupinstall "Development tools"

[[email protected] packages]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

3.下载python3.5安装包

[[email protected] python]# wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz

[[email protected] python]# tar -xf Python-3.5.0.tgz 

[[email protected] python]# cd Python-3.5.0

[[email protected] Python-3.5.0]# ./configure --prefix=/usr/local --enable-shared //指定安装路径,并生成动态链接库

[[email protected] Python-3.5.0]# make -j 4 && make install

[[email protected] Python-3.5.0]# ln -s /usr/local/bin/python3 /usr/bin/python3

 4.生成动态库信息并验证

[[email protected] Python-3.5.0]# echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf

[[email protected] Python-3.5.0]# ldconfig

[[email protected] Python-3.5.0]# python3 --version
Python 3.5.0
[[email protected] Python-3.5.0]#

5.定义一个别名,这样就不用每次tab出来还要选择 了

[[email protected] Python-3.5.0]# echo “#Add python3.5 alias by yinzhengjie” >> /etc/bashrc

[[email protected] Python-3.5.0]# echo "alias py=python3” >> /etc/bashrc    

[[email protected] Python-3.5.0]# py --version
Python 3.5.0
[[email protected] Python-3.5.0]#

 



以上是关于在CentOs服务器上源码安装python3.5的主要内容,如果未能解决你的问题,请参考以下文章

python之 centos6.7下 python 3.5.2 源码Django-1.9 安装

CentOS7 Python3上安装paramiko

CentOS 安装python3.5

centos6.8安装python3.5.2

烂泥:python2.7和python3.5源码安装

烂泥:python2.7和python3.5源码安装