CentOS7下python3.x的源码安装
Posted hovin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7下python3.x的源码安装相关的知识,希望对你有一定的参考价值。
一、安装过程
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的源码安装的主要内容,如果未能解决你的问题,请参考以下文章
centos7下部署Django(nginx+uwsgi+django+python3)
如何升级到python3版本并且安装pip3及ipython3