1、CentOS安装Python的依赖包

1.环境
安装金沙城中心赌场 ,CentOS
7.2最小系统(CentOS-7-x86_64-Minimal-1511.iso)

yum groupinstall “Development tools”
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel
sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel
xz-devel

2.需求
Python-3.6.4.tar.xz(官网下载)

2、下载Python3.4的源码包并编译

GCC(yum安装)

wget
tar xf Python-3.4.1.tgz
cd Python-3.4.1
./configure –prefix=/usr/local –enable-shared
make
make install

一堆开发库(yum安装)

3、在运行Python之前需要配置库:

3.编译
3.1安装编译器
yum -y install gcc3.2安装依赖

echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf
ldconfig

yum -y install bzip2-devel sqlite-devel openssl-devel readline-devel
xz-devel xz-devel tk-devel gdbm-devel3.3编译源码
tar Jxvf Python-3.6.4.tar.xz

4、运行演示:

cd Python-3.6.4

python3 –version
Python 3.4.1

./configure

5、删除编译Python时所需要的库

(如果需要发布版,则配置时要开优化,编译较慢./configure
–enable-optimizations)
make -j4

yum groupremove “Development tools” –remove-leaves
yum remove zlib-devel bzip2-devel openssl-devel ncurses-devel
sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel
xz-devel –remove-leaves

make install默认安装到/usr/local

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图