centos安装python3

安装编译环境

sudo yum -y groupinstall "Development tools"
sudo 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

下载python安装包

wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
# 解压包
tar -xvf Python-3.6.8.tar.xz

安装python

# 进入解压目录
cd Python-3.6.8

# 生成MakeFile
sudo ./configure --prefix=/usr/local/python3.6.8 --enable-optimizations

# 安装 使用make atinstall避免替换默认的python执行文件
sudo make altinstall

设置软连接到/user/bin/文件夹

sudo ln -s /usr/local/python3.6.8/bin/python3.6 /usr/bin/python3
sudo ln -s /usr/local/python3.6.8/bin/pip3.6 /usr/bin/pip3

最后运行查看是否安装成功:

[root@jeremyqin1584598822574-0 ~/Python-3.6.8]# python3
Python 3.6.8 (default, Mar  2 2021, 23:48:16) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

 

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 技术工厂 设计师:CSDN官方博客 返回首页