CentOS7下python3.x的源码安装

2021-04-30 01:27

阅读:452

标签:编译安装   inux   curses   建立   info   adl   https   copy   span   

一、安装过程

1、下载源码包

 下载地址:https://www.python.org/downloads/source/

 或:https://www.python.org/ftp/python/

2、解压安装包,以python 3.7.8为例

[root@localhost ~]# ll Python-3.7.8.tgz 
-rw-r--r-- 1 root root 23276116 Jul  3 16:40 Python-3.7.8.tgz
[root@localhost ~]# tar -zxvf Python-3.7.8.tgz

3、安装相关依赖包

[root@localhost ~]# 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 libffi-devel

4、开始编译安装

[root@localhost ~]# cd Python-3.7.8/
[root@localhost Python-3.7.8]# ./configure --prefix=/usr/local/python3
[root@localhost Python-3.7.8]# make && make install

5、建立软链接

[root@localhost Python-3.7.8]# ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
[root@localhost Python-3.7.8]# ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3

6、测试

[root@localhost Python-3.7.8]# python3
Python 3.7.8 (default, Jul  3 2020, 16:47:10) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@localhost Python-3.7.8]# pip3 --version
pip 20.1.1 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)

 

CentOS7下python3.x的源码安装

标签:编译安装   inux   curses   建立   info   adl   https   copy   span   

原文地址:https://www.cnblogs.com/hovin/p/13231333.html


评论


亲,登录后才可以留言!