Python3+Allure+Pytest 安装部署
1、Python3 普通用户安装:
1.1、安装依赖
# 安装 python 依赖 yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make libffi-devel
1.2、下载安装包
wget https://www.python.org/ftp/python/3.7.7/Python-3.7.7.tgz
1.3、安装
# python 源码包安装 # 1、创建安装目录 /home/5grmt/opt/python3 # 2、解压安装包 tar -xf Python-3.7.7.tgz # 3、编译安装 cd Python-3.7.7 ./configure --prefix=/home/5grmt/opt/python3 make make install
# 4、配置环境变量
vim ~/.bash_profile
PYTHON_HOME=/home/5grmt/opt/python3/
PATH=$PATH:$PYTHON_HOME/bin:$ALLURE_HOME/bin
export PATH
# 5、使配置生效
source ~/.bash_profile
2、安装Allure
2.1、下载安装包
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.17.0/allure-commandline-2.17.0.tgz
2.2、解压安装
# 1、解压 tar -xf allure-commandline-2.17.0.tgz -C ../opt/ # 2、创建软链接 cd ~/opt ln -s allure-2.17.0/ allure # 3、配置环境变量 vim ~/.bash_profile ALLURE_HOME=/home/5grmt/opt/allure/ PATH=$PATH:$PYTHON_HOME/bin:$ALLURE_HOME/bin # 4、使环境变量生效 source ~/.bash_profile
3、升级pip
python3 -m pip install --upgrade pip -i https://pypi.douban.com/simple
4、安装pytest
pip3 install pytest -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
5、pip换源
# 方案一:修改配置文件 # 首先在当前用户目录下建立文件夹.pip,然后在文件夹中创建pip.conf文件,再将源地址加进去即可。 mkdir ~/.pip vim ~/.pip/pip.conf # 然后将下面这两行复制进去就好了 [global] index-url = https://mirrors.aliyun.com/pypi/simple # 国内其他pip源 清华:https://pypi.tuna.tsinghua.edu.cn/simple 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 华中理工大学:http://pypi.hustunique.com/ 山东理工大学:http://pypi.sdutlinux.org/ 豆瓣:http://pypi.douban.com/simple/ # 临时给pip 或 pip3换源 #pip3 install 包名 -i 镜像源url pip3 install hmmlearn -i https://mirrors.aliyun.com/pypi/simple
浙公网安备 33010602011771号