首页 > 代码库 > linux安装python3

linux安装python3

1.安装openssl静态库【pip3安装需要,如果已经安装请跳过】

yum install -y openssl-static

2.安装GCC和wget【如果已经安装请跳过】

yum install -y gcc wget

yum groupinstall "Development tools"

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

3.下载python3的源码包
wget http://python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz

4.加压源码包
tar xf Python-3.6.1.tar.xz

5.设置安装路径
cd Python-3.6.1
./configure --prefix=/usr/local/python3

6.编译安装包并安装
make
make install

7.添加文件链接,因为我们自定义了安装路径
ln -s /usr/local/python3/bin/python3 /usr/bin/python3

8.检验是否安装成功,出现以下界面说明成功了
python3 -V

技术分享

9.配置pip3快捷方式

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

技术分享

 

linux安装python3