【python入门】如何生成和安装requirements.txt依赖?

【python入门】如何生成和安装requirements.txt依赖?requirements添加,如何使用pip3install-rrequirements.txt

1、生成 requirements.txt 文件
pip3 freeze > requirements.txt

生成后,打开文件requirements.txt,
本地所有依赖都自动添加到文件里(可以视项目需要删减)

absl-py==0.9.0
allure-pytest==2.6.2
allure-python-commons==2.6.2
atlassian-python-api==1.17.5
atomicwrites==1.3.0
attrs==19.1.0
Automat==0.7.0
baidu-aip==2.2.18.0
2、安装requirements.txt文件里的依赖
pip3 install -r requirements.txt
3、安装依赖过程
(1)如requirements.txt里需要安装以下依赖
pyyaml==5.3.1
assertpy==1.1
pytest==6.0.2
lxml==4.5.2
Appium-Python-Client==1.0.2
(2)安装依赖过程
> pip3 install -r requirements.txt               
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting pyyaml==5.3.1 (from -r requirements.txt (line 1))
  Using cached https://mirrors.aliyun.com/pypi/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz
Collecting assertpy==1.1 (from -r requirements.txt (line 2))
  Downloading https://mirrors.aliyun.com/pypi/packages/4f/39/720b5d4463612a40a166d00999cbb715fce3edaf08a9a7588ba5985699ec/assertpy-1.1.tar.gz
Collecting pytest==6.0.2 (from -r requirements.txt (line 3))
  Downloading https://mirrors.aliyun.com/pypi/packages/45/2c/7e29215cb19745ad67b6476b73fd1299872563f28329ea01d9d887713aaf/pytest-6.0.2-py3-none-any.whl (270kB)
     |████████████████████████████████| 276kB 1.3MB/s 
Collecting lxml==4.5.2 (from -r requirements.txt (line 4))
  Downloading https://mirrors.aliyun.com/pypi/packages/87/34/460f1df365685ac91d9eba233c3b1f6980bb266048f770609fbec4691998/lxml-4.5.2-cp37-cp37m-macosx_10_9_x86_64.whl (4.4MB)
     |████████████████████████████████| 4.4MB 4.2MB/s 
Collecting Appium-Python-Client==1.0.2 (from -r requirements.txt (line 5))
  Downloading https://mirrors.aliyun.com/pypi/packages/21/ca/3261b5da5b6851ea5297f44b2dc7f3167f00a7ce3e99907b49bf69c56360/Appium-Python-Client-1.0.2.tar.gz (51kB)
     |████████████████████████████████| 61kB 2.5MB/s 
Collecting py>=1.8.2 (from pytest==6.0.2->-r requirements.txt (line 3))
  Downloading https://mirrors.aliyun.com/pypi/packages/68/0f/41a43535b52a81e4f29e420a151032d26f08b62206840c48d14b70e53376/py-1.9.0-py2.py3-none-any.whl (99kB)
     |████████████████████████████████| 102kB 1.9MB/s 
Requirement already satisfied: more-itertools>=4.0.0 in /usr/local/lib/python3.7/site-packages (from pytest==6.0.2->-r requirements.txt (line 3)) (7.0.0)
Collecting toml (from pytest==6.0.2->-r requirements.txt (line 3))
  Downloading https://mirrors.aliyun.com/pypi/packages/9f/e1/1b40b80f2e1663a6b9f497123c11d7d988c0919abbf3c3f2688e448c5363/toml-0.10.1-py2.py3-none-any.whl
Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.7/site-packages (from pytest==6.0.2->-r requirements.txt (line 3)) (19.1.0)
Requirement already satisfied: importlib-metadata>=0.12; python_version < "3.8" in /usr/local/lib/python3.7/site-packages (from pytest==6.0.2->-r requirements.txt (line 3)) (1.7.0)
Collecting pluggy<1.0,>=0.12 (from pytest==6.0.2->-r requirements.txt (line 3))
  Downloading https://mirrors.aliyun.com/pypi/packages/a0/28/85c7aa31b80d150b772fbe4a229487bc6644da9ccb7e427dd8cc60cb8a62/pluggy-0.13.1-py2.py3-none-any.whl
Collecting packaging (from pytest==6.0.2->-r requirements.txt (line 3))
  Downloading https://mirrors.aliyun.com/pypi/packages/46/19/c5ab91b1b05cfe63cccd5cfc971db9214c6dd6ced54e33c30d5af1d2bc43/packaging-20.4-py2.py3-none-any.whl
Collecting iniconfig (from pytest==6.0.2->-r requirements.txt (line 3))
  Downloading https://mirrors.aliyun.com/pypi/packages/20/46/d2f4919cc48c39c2cb48b589ca9016aae6bad050b8023667eb86950d3da2/iniconfig-1.0.1-py3-none-any.whl
Requirement already satisfied: selenium<4,>=3.14.1 in /usr/local/lib/python3.7/site-packages (from Appium-Python-Client==1.0.2->-r requirements.txt (line 5)) (3.141.0)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/site-packages (from importlib-metadata>=0.12; python_version < "3.8"->pytest==6.0.2->-r requirements.txt (line 3)) (3.1.0)
Requirement already satisfied: six in /usr/local/lib/python3.7/site-packages (from packaging->pytest==6.0.2->-r requirements.txt (line 3)) (1.12.0)
Requirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.7/site-packages (from packaging->pytest==6.0.2->-r requirements.txt (line 3)) (2.4.0)
Requirement already satisfied: urllib3 in /usr/local/lib/python3.7/site-packages (from selenium<4,>=3.14.1->Appium-Python-Client==1.0.2->-r requirements

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/34485.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注