Centos7安装Python3.7

it2024-12-10  16

Centos7安装Python3.7

注意:全部操作都在root用户下执行

1.安装编译相关工具

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

2.下载安装包解压

cd /baicdt/softwares/ wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz tar -xvJf Python-3.7.0.tar.xz

3.编译安装

#创建编译安装目录 mkdir /usr/local/python3 #开始编译 cd /baicdt/softwares/Python-3.7.0 ./configure --prefix=/usr/local/python3 make && make install

4.创建软连接

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

5.验证是否成功

python3 -V pip3 -V
最新回复(0)