一、安装Python-3.6.2.tgz
-
安装依赖环境
最小化安装Redhat6.4环境下
yum -y install gcc make zlib-devel bzip2-devel ncurses-devel readline-devel
(yum -y install gcc make zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel db4-devel gdbm-devel libpcap-devel xz-devel)
2.mkdir -p /usr/local/python3.6
3.编译安装
tar -zxvf Python-3.6.2.tgz
cd Python-3.6.2
./configure --prefix=/usr/local/python3.6
make
make install
4.设置python3.6为默认python命令,并设置yum的配置
cd /usr/bin
mv python pythonold
vi yum
将#!/usr/bin/pythono改成#!/usr/bin/pythonold
ln -s /usr/local/python3.6/bin/python3.6 python
二、安装第三方库
注:python3默认已经安装,使用方法如下:
ln -s /usr/local/python3.6/bin/easy_install-3.6 /usr/bin/easy_install
ln -s /usr/local/python3.6/bin/pip3.6 /usr/bin/pip
pip install pyreadline
easy_install pyreadline
-----------------------------------
1、安装setuptools-19.6.tar.gz
tar -zxvf setuptools-19.6.tar.gz
cd setuptools-19.6
python setup.py build
python setup.py install
2、安装pip-8.0.2.tar.gz
tar -zxvf pip-8.0.2.tar.gz
cd pip-8.0.2
python setup.py build
python setup.py install