Centos7 下安装python3.7.5 + robotframework
1、安装依赖包
sudo yum -y install epel-release zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make libffi-devel
2、下载python3.7源码包
wget https://mirrors.huaweicloud.com/python/3.7.5/Python-3.7.5.tgz
解压缩
tar -zxvf Python-3.7.5.tgz
3、编译安装
cd Python-3.7.5
添加 --enable-optimizations才能下载https的pip源
./configure prefix=/usr/local/python3 --enable-optimizations
make && make install
4、添加软链
备份python软连接
mv /usr/bin/python /usr/bin/python-bak
mv /usr/bin/pip /usr/bin/pip-bak
添加python3的软链接
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python
添加 pip3 的软链接
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip
测试是否安装成功了
python -V
5、更改yum配置,因为其要用到python2才能执行,否则会导致yum不能正常使用(不管安装 python3的那个版本,都必须要做的)
vi /usr/bin/yum
把 #! /usr/bin/python 修改为 #! /usr/bin/python2
vi /usr/libexec/urlgrabber-ext-down
6、添加pip镜像加速
<!--1、进入~目录-->
cd ~
<!--2、创建.pip文件夹-->
mkdir .pip
<!--3、进入.pip文件夹-->
cd .pip/
<!--4、新建pip.conf文件-->
touch pip.conf
<!--5、编辑pip.conf文件,输入内容如下:-->
vim pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
7、安装robotframework
pip install -U robotframework==3.2.1
#pip install robotframework-sshlibrary
#建立软链
ln -s /usr/local/python3/bin/robot /usr/bin/robot
THE END
二维码