首页 > 代码库 > 在CentOs服务器上源码安装python3.5
在CentOs服务器上源码安装python3.5
在CentOs服务器上源码安装python3.5
作者:尹正杰
1.系统环境介绍
2.安装依赖包
[root@yinzhengjie packages]# yum -y groupinstall "Development tools"
[root@yinzhengjie 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安装包
[root@yinzhengjie python]# wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
[root@yinzhengjie python]# tar -xf Python-3.5.0.tgz
[root@yinzhengjie python]# cd Python-3.5.0
[root@yinzhengjie Python-3.5.0]# ./configure --prefix=/usr/local --enable-shared //指定安装路径,并生成动态链接库
[root@yinzhengjie Python-3.5.0]# make -j 4 && make install
[root@yinzhengjie Python-3.5.0]# ln -s /usr/local/bin/python3 /usr/bin/python3
4.生成动态库信息并验证
[root@yinzhengjie Python-3.5.0]# echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf
[root@yinzhengjie Python-3.5.0]# ldconfig
[root@yinzhengjie Python-3.5.0]# python3 --version
Python 3.5.0
[root@yinzhengjie Python-3.5.0]#
5.定义一个别名,这样就不用每次tab出来还要选择 了
[root@yinzhengjie Python-3.5.0]# echo “#Add python3.5 alias by yinzhengjie” >> /etc/bashrc
[root@yinzhengjie Python-3.5.0]# echo "alias py=python3” >> /etc/bashrc
[root@yinzhengjie Python-3.5.0]# py --version
Python 3.5.0
[root@yinzhengjie Python-3.5.0]#
在CentOs服务器上源码安装python3.5