CentOS7.2安装Python3.6.3

一、准备工作

1.1 安装centos7.2.1511 

1.2 下载python3.6.3 安装包(下载地址:https://www.python.org/downloads/

1.3 安装依赖包:

yum -y install xz tar gcc make tk-devel wget sqlite-devel zlib-devel readline-devel openssl-devel curl-devel tk-devel gdbm-devel xz-devel bzip2-devel

1.4  创建安装目录:

mkdir -p /usr/local/python3

 

二、安装

2.1 解压python3.6.3安装包:

tar -zxvf Python-3.6.3.tgz

2.2 进入解压后的目录,编译安装:

# cd Python-3.6.3

# ./configure --prefix=/usr/local/python3

# make && make install

2.3 建立python3软连接

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

2.4 修改环境变量

# echo 'export PATH=/usr/local/python3/bin:$PATH' >> /etc/profile

# source /etc/profile

2.5 安装完成后检查Python3及pip3是否正常可用

# python3 -V

# pip3 -V

 

2.6 说明:CentOS系统原有python2.7.5没有改变,仍然用python调用即可


安装3.7.3报错问题汇总:
# ./configure --prefix=/usr/local/python3 输入报错

解决:yum -y install gcc、yum -y install gcc-c++ 

 

安装好python3.7.3后无pip模块原因

解决:yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel libffi-devel

 
posted @ 2018-11-26 15:04  Crazyjump  阅读(1233)  评论(0编辑  收藏  举报