WEB接口开发与自动化测试-读书笔记1 Python安装

Python安装

安装Python及配置环境变量

一、博主自言

此篇文章是博主自学的笔记整理,顺便分享给大家。

希望会对大家有所帮助,欢迎留言提问。

二、Python的安装

2.1下载Python

下载地址:https://www.python.org/downloads/(目前最新版本为Python3.8,以下安装以3.6为例)
根据自已的系统平台选择相应的版本进行下载。
在这里插入图片描述

2.2 安装Python

2.2.1下载完成后双击执行下载的exe程序,进入安装界面。

在这里插入图片描述
安装过程中记得勾选“Add Python 3.X to PATH”选项。

2.2.2安装过程中记得勾选“Add Python 3.X to PATH”选项。安装完成在开始菜单中生成Python3.X的目录

在这里插入图片描述

  • IDLE(Python 3.X 64-bit):Python自带的IDE。
  • Python 3.X( 64-bit):在Windows命令提示符下进入Python Shell模式。
  • Python 3.X Manuals(64-bit):Python自带的官方文档。
  • Python 3.X Module Docs(64-bit):Python的模块文档。它自动启动一个服务,以Web形式显示Python模块的文档。
2.2.3 安装完毕后,打开CMD输入python,返回版本号即安装成功

在这里插入图片描述

2.3 配置环境变量

首先找到python安装目录,添加到“右击我的电脑-属性-高级系统变量-高级-环境变量-系统变量-Path-编辑-目录粘贴到Path下面。
在这里插入图片描述

三、扩展库的安装

我们学习Python,例如要开发Web网站,我要做Web UI自动化测试,这就少不了要安装第三方扩展库。
所以,接下来可以在PyPI(Python Package Index)中查找想要的库。
PyPI地址:https://pypi.python.org/pypi

3.1 pip 安装扩展库

pip是一个安装和管理Python包的工具,通过pip来管理Python包非常简单。

3.1.1 查看pip是否可用

运行CMD,输入“pip”命令,出现命令说明,可以正常使用。(提示错误,到python目录找到Scripts,添加到系统变量Path下面)。
C:\Windows\system32>pip

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  debug                       Show information useful for debugging.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to
                              WARNING, ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup,
                              (a)bort.
  --trusted-host <hostname>   Mark this host as trusted, even though it does not have valid or any HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the
                              certificate in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new version of pip is available for
                              download. Implied with --no-index.
  --no-color                  Suppress colored output

C:\Windows\system32>pip show django
Name: Django
Version: 2.2.7
Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Home-page: https://www.djangoproject.com/
Author: Django Software Foundation
Author-email: foundation@djangoproject.com
License: BSD
Location: c:\program files\python38\lib\site-packages
Requires: sqlparse, pytz
Required-by:
3.1.2 使用pip安装扩展库
pip install django

Django是Python下面开发Web项目非常强大的一个库,也是接下来学习的重点。

3.1.3 使用pip安装指定版本的库
pip install django=1.10.3
3.1.4 查看当前安装的库
pip show django

使用show命令查看库的版本号和安装路径。
在这里插入图片描述

3.1.5 使用pip卸载库
pip uninstall django

使用uninstall命令即可装安装的库轻松卸载。

总结

1、安装Python,过程中勾选“Add Python 3.X to PATH”选项;
2、安装完成后再Windows命令提示符下“python”命令,验证是否安装成功;
3、使用pip安装Django扩展库;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值