前言

记录一下centos7安装python过程

开始

安装依赖库

yum -y update
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel xz-devel 
yum -y install gcc make wget libffi-devel

下载源码

cd ~ && \
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz && \
tar -xvJf  Python-3.7.0.tar.xz

编译安装

mkdir /usr/local/python3
cd ~/Python-3.7.0  && \
./configure --prefix=/usr/local/python3 && \
make && make install 
(出现zlib*等错误时: yum -y install zlib*)

建立连接

ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3  && \
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3

测试查看版本

python3 -V
pip3 -V

以上就是安装python的详细步骤了.

最后修改:2020 年 11 月 19 日
如果觉得我的文章对你有用,请随意赞赏