- 必须root下执行,普通用户(bigdata)下sudo执行make && make install 时某些包权限受限,会报错
- 可与python2兼容
下载安装包:
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
解压:
tar -zxvf Python-3.6.1.tgz
建立一个空文件夹,用于存放python3程序:
mkdir /usr/local/python3
编译安装:
cd Python-3.6.1
./configure --prefix=/usr/local/python3
make && make altinstall
注意这里有个坑:使用make altinstall,如果使用make install,安装过程中没有报错,但是执行python3找不到命令,需要卸载重装。
如果遇到报错:
configure: error: in `/root/Python-3.6.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
是gcc未安装,先安装gcc
yum