原创

Linux安装Python3

1、安装wget

yum install wget gcc-c++ zlib zlib-devel -y

2、下载python3,可以是其他python3版本

wget https://www.python.org/ftp/python/3.9.16/Python-3.9.16.tar.xz

3、解压

tar xf Python-3.9.16.tar.xz

4、安装

cd Python-3.9.16
./configure --prefix=/usr/local/python3
make && make install

5、配置软链

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

6、验证python3

[root@localhost ~]# python3
Python 3.9.16 (main, Jan 11 2023, 11:13:45) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 


正文到此结束
评论

登录后才能发表评论 登录/注册

0评论
  • 还没有评论,快来抢沙发吧!