
上QQ阅读APP看书,第一时间看更新
1.2.1 安装Python 3.10
本书中使用的Python版本是截至2021年10月份的新版本(即Python 3.10.0)。下面介绍其具体的安装步骤,安装环境是Windows 11家庭版64位操作系统。
注意
Python需要安装包到计算机磁盘根目录或英文路径文件夹下,即安装路径不能有中文。
首先需要下载Python 3.10.0,官方网站的下载地址如图1-3所示。

图1-3 下载Python软件
右击python-3.10.0-amd64.exe,选择“以管理员身份运行”,如图1-4所示。

图1-4 运行安装程序
打开Python 3.10.0安装界面,勾选Add Python 3.10 to PATH,然后单击Customize installation,如图1-5所示。

图1-5 自定义安装
根据需要选择自定义的选项,其中pip必须勾选,然后单击Next按钮,如图1-6所示。

图1-6 功能选项
选择软件安装位置,默认安装在C盘,单击Browse按钮可更改软件的安装目录,然后单击Install按钮,如图1-7所示。

图1-7 高级选项
稍等片刻,出现Setup was successful对话框,说明正常安装,单击Close按钮即可,如图1-8所示。

图1-8 安装结束
在命令提示符中输入“python”后,如果出现如图1-9所示的信息,即Python版本信息,则说明安装没有问题,可以正常使用Python。

图1-9 查看版本信息
在Python中可以使用pip与conda工具安装第三方库(如NumPy、Pandas等),命令如下:
pip install 库的名称 conda install 库的名称
此外,如果无法正常在线安装第三方库,可以下载新版本的离线文件,然后再安装,适用于Python扩展程序包的非官方Windows二进制文件如图1-10所示。

图1-10 非官方扩展程序包