- A+
所属分类:linux技术
一、部署准备工作
部署环境工具检查及安装
1)安装epel-release库,以防db4-devel依赖安装失败
1 yum -y install epel-release
2)安装外部函数库(libffi)
1 yum -y install libffi-devel
3)安装编译环境依赖(必须全部安装成功,否则会编译失败)
1 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
4)安装gcc
1 yum -y install gcc
5)安装rz
1 yum -y install lrzsz
二、Python安装配置工作
Python安装及Python环境变量配置
1)rz选择上传python3.X的tgz安装包
1 rz
这里选用Python3.7.1版本,上传Python-3.7.1.tgz。
2)用tar命令解压Python-3.7.1.tgz
1 tar -zxvf Python-3.7.1.tgz
3)切换到Python-3.7.1目录下
1 cd Python-3.7.1
用configure将/usr/local/python3设置成安装目录
1 ./configure --prefix=/usr/local/python3
4)编译安装 make && make install(如果显示安装成功 就说明可以 如果提示失败 检查下依赖环境)
1 make && make install
5)创建Python3和pip3的软连接
1 ln -s /usr/local/python3/bin/python3 /usr/bin/python3 2 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
6)将/usr/local/python3/bin加入PATH变量中
1 vim ~/.bash_profile
#python path
echo export PYTHON_PATH=/usr/local/python3
echo PATH=$PYTHON_PATH/bin:$PATH
修改之后source一下使变量生效。
1 source ~/.bash_profile
7)检查Python3.7.1是否安装好,Python2是否能运行
1 python3
1 exit() #退出Python3
1 python2
1 exit()