CEN02 - Installing Python on Your Computer

2023-12-05 20:12

本文主要是介绍CEN02 - Installing Python on Your Computer,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

  • I. Introduction
  • II. Installing Python
    • 1. Download the latest version of Python from the official website
    • 2. Run the installer and follow the installation wizard
    • 3. Ensure that the "Add Python.exe to PATH" checkbox is checked for easier command-line access
    • 4. Complete the installation process
  • III. Using Command-Line Python for Fun
    • 1. Open the command-line Python from the start menu
    • 2. Use the print function to display a message on the screen
    • 3. Perform basic operations, such as addition, using Python statements
    • 4. Type exit() and press Enter to quit the command-line Python
  • IV. Using Python with IDLE Window
    • 1. Open the IDLE Python from the start menu
    • 2. Perform operations interactively
    • 3. Write a Python program in the IDLE code editor window
    • 4. Save the Python program at the spciefied location
    • 5. Run a Python program in IDLE
  • V. Conclusion
  • I. 引言
  • II. 安装Python
    • 1. 从官方网站下载最新版本的Python
    • 2. 运行安装程序并遵循安装向导
    • 3. 确保选中了“添加Python.exe到PATH”复选框,以便于命令行访问
    • 4. 完成安装过程
  • III. 使用命令行Python的乐趣
    • 1. 从开始菜单打开命令行Python
    • 2. 使用print函数在屏幕上显示消息
    • 3. 使用Python语句执行基本操作,例如加法
    • 4. 输入exit()并按Enter键退出命令行Python

I. Introduction

  • Today, I will guide you through the process of installing Python on your computer and using command-line python and IDLE.

II. Installing Python

1. Download the latest version of Python from the official website

  • Python’s official website is https://www.python.org/.
    在这里插入图片描述
  • Navigate to the “Downloads” section by clicking the corresponding link in the navigation bar.
    在这里插入图片描述
  • Click the “Download Python 3.12.0” button
    在这里插入图片描述
  • Click the “Download Immediately” button to download the Python installer to the designated location on my computer.
    在这里插入图片描述

2. Run the installer and follow the installation wizard

  • Choose Customize to enable or disable features
    在这里插入图片描述

3. Ensure that the “Add Python.exe to PATH” checkbox is checked for easier command-line access

  • Note that the ‘Add Python.exe to Path’ checkbox is checked.在这里插入图片描述
  • Click the “Customize installation” option
    在这里插入图片描述
  • Keep the Optional Features unchanged. And then click the “Next” button.
    在这里插入图片描述
  • Enter the new path D:\Python\Python312 in the ‘Customize install location’ textbox.
    在这里插入图片描述
  • Click the “Install” button to initiate the installation process.
    在这里插入图片描述

4. Complete the installation process

  • When the installation is complete, you will see the message “Setup was successful” in the installation window.
    在这里插入图片描述
  • Now let’s check where Python is installed.
    在这里插入图片描述
  • python.exe is used for the command-line window, while pythonw.exe is utilized for the IDLE window.

III. Using Command-Line Python for Fun

1. Open the command-line Python from the start menu

  • Click the “Start Menu” button to open the start menu.在这里插入图片描述
  • Click the “Python 3.12 (64-bit)” option to launch the Python command-line window.
    在这里插入图片描述

2. Use the print function to display a message on the screen

  • Display a message “Welcome to Python World~”
    在这里插入图片描述

3. Perform basic operations, such as addition, using Python statements

  • Let me perform addition using Python statements.
    在这里插入图片描述
  • Note that Python has three types of formatted printing: % formatting, the format() function, and f-strings.

4. Type exit() and press Enter to quit the command-line Python

  • Type exit() function
    在这里插入图片描述
  • Press Enter to quit the commad-line Python

IV. Using Python with IDLE Window

1. Open the IDLE Python from the start menu

  • Click the “Start Menu” button to open the start menu.
    在这里插入图片描述
  • Click the “IDLE (Python 3.12 64-bit)” option to open the Python IDLE window.
    在这里插入图片描述

2. Perform operations interactively

  • Let me perform addition using Python statements.
    在这里插入图片描述

3. Write a Python program in the IDLE code editor window

  • Click the “File” menu and choose “New File…” to open an IDLE code window.
    在这里插入图片描述
  • Write a program to perform the addition of two numbers.
    在这里插入图片描述

4. Save the Python program at the spciefied location

  • Click on the File menu in the IDLE code window.
  • Choose the “Save As…” option.
    在这里插入图片描述
  • Navigate to the location where you want to save the file.
    在这里插入图片描述
  • Enter a suitable file name with the “.py” extension (e.g., “addition.py”).
    在这里插入图片描述
  • Click the “Save” button. Now, your Python program is saved at the specified location with the given file name.
    在这里插入图片描述

5. Run a Python program in IDLE

  • Open IDLE (Python GUI) on your computer.
    在这里插入图片描述
  • Open a Python program stored on my disk
    在这里插入图片描述
  • Choose the Python program at the designated location
    在这里插入图片描述
  • Click the “Open” button
    在这里插入图片描述
  • Press the F5 key or select “Run Module” from the “Run” menu. By doing this, IDLE will execute your Python script, and you should see the output in the interactive shell window. If there are no errors, your program will run successfully.
    在这里插入图片描述

V. Conclusion

  • Installing Python is a straightforward process that ensures a clean and functional Python environment on your computer.
  • Always use the official Python installer and follow recommended procedures for a hassle-free experience.

Feel free to reach out if you have any questions or encounter issues during the process. Let’s get started!


I. 引言

  • 今天,我将引导您完成在计算机上安装Python并使用命令行Python和IDLE的过程。

II. 安装Python

1. 从官方网站下载最新版本的Python

  • Python的官方网站是https://www.python.org/。
    在这里插入图片描述
  • 单击导航栏中的相应链接转到“下载”部分。
    在这里插入图片描述
  • 单击“下载Python 3.12.0”按钮
    在这里插入图片描述
  • 单击“立即下载”按钮将Python安装程序下载到计算机上的指定位置。
    在这里插入图片描述

2. 运行安装程序并遵循安装向导

  • 选择自定义来启用或禁用功能
    在这里插入图片描述

3. 确保选中了“添加Python.exe到PATH”复选框,以便于命令行访问

  • 注意“将Python.exe添加到路径”复选框已勾选。 在这里插入图片描述
  • 单击“自定义安装”选项
    在这里插入图片描述
  • 保持可选功能不变。然后单击“下一步”按钮。
    在这里插入图片描述
  • 在“自定义安装位置”文本框中输入新的路径D:\Python\Python312
    在这里插入图片描述
  • 单击“安装”按钮启动安装过程。
    在这里插入图片描述

4. 完成安装过程

  • 当安装完成后,您将在安装窗口中看到“设置成功”消息。
    在这里插入图片描述
  • 现在让我们检查一下Python安装在哪里。
    在这里插入图片描述
  • python.exe用于命令行窗口,而pythonw.exe用于IDLE窗口。

III. 使用命令行Python的乐趣

1. 从开始菜单打开命令行Python

  • 单击“开始菜单”按钮打开开始菜单。
    在这里插入图片描述
  • 单击“Python 3.12(64位)”选项以启动Python命令行窗口。
    在这里插入图片描述

2. 使用print函数在屏幕上显示消息

  • 显示一条消息“欢迎来到Python世界~”
    在这里插入图片描述

3. 使用Python语句执行基本操作,例如加法

  • 让我使用Python语句执行加法。
    在这里插入图片描述
  • 注意Python有三种格式化打印方式:%格式化、format()函数和f字符串。

4. 输入exit()并按Enter键退出命令行Python

  • 输入exit()函数
    在这里插入图片描述
  • 按Enter键退出命令行Python

这篇关于CEN02 - Installing Python on Your Computer的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/458977

相关文章

Python实现AVIF图片与其他图片格式间的批量转换

《Python实现AVIF图片与其他图片格式间的批量转换》这篇文章主要为大家详细介绍了如何使用Pillow库实现AVIF与其他格式的相互转换,即将AVIF转换为常见的格式,比如JPG或PNG,需要的小... 目录环境配置1.将单个 AVIF 图片转换为 JPG 和 PNG2.批量转换目录下所有 AVIF 图

Python通过模块化开发优化代码的技巧分享

《Python通过模块化开发优化代码的技巧分享》模块化开发就是把代码拆成一个个“零件”,该封装封装,该拆分拆分,下面小编就来和大家简单聊聊python如何用模块化开发进行代码优化吧... 目录什么是模块化开发如何拆分代码改进版:拆分成模块让模块更强大:使用 __init__.py你一定会遇到的问题模www.

详解如何通过Python批量转换图片为PDF

《详解如何通过Python批量转换图片为PDF》:本文主要介绍如何基于Python+Tkinter开发的图片批量转PDF工具,可以支持批量添加图片,拖拽等操作,感兴趣的小伙伴可以参考一下... 目录1. 概述2. 功能亮点2.1 主要功能2.2 界面设计3. 使用指南3.1 运行环境3.2 使用步骤4. 核

Python 安装和配置flask, flask_cors的图文教程

《Python安装和配置flask,flask_cors的图文教程》:本文主要介绍Python安装和配置flask,flask_cors的图文教程,本文通过图文并茂的形式给大家介绍的非常详细,... 目录一.python安装:二,配置环境变量,三:检查Python安装和环境变量,四:安装flask和flas

使用Python自建轻量级的HTTP调试工具

《使用Python自建轻量级的HTTP调试工具》这篇文章主要为大家详细介绍了如何使用Python自建一个轻量级的HTTP调试工具,文中的示例代码讲解详细,感兴趣的小伙伴可以参考一下... 目录一、为什么需要自建工具二、核心功能设计三、技术选型四、分步实现五、进阶优化技巧六、使用示例七、性能对比八、扩展方向建

基于Python打造一个可视化FTP服务器

《基于Python打造一个可视化FTP服务器》在日常办公和团队协作中,文件共享是一个不可或缺的需求,所以本文将使用Python+Tkinter+pyftpdlib开发一款可视化FTP服务器,有需要的小... 目录1. 概述2. 功能介绍3. 如何使用4. 代码解析5. 运行效果6.相关源码7. 总结与展望1

使用Python实现一键隐藏屏幕并锁定输入

《使用Python实现一键隐藏屏幕并锁定输入》本文主要介绍了使用Python编写一个一键隐藏屏幕并锁定输入的黑科技程序,能够在指定热键触发后立即遮挡屏幕,并禁止一切键盘鼠标输入,这样就再也不用担心自己... 目录1. 概述2. 功能亮点3.代码实现4.使用方法5. 展示效果6. 代码优化与拓展7. 总结1.

使用Python开发一个简单的本地图片服务器

《使用Python开发一个简单的本地图片服务器》本文介绍了如何结合wxPython构建的图形用户界面GUI和Python内建的Web服务器功能,在本地网络中搭建一个私人的,即开即用的网页相册,文中的示... 目录项目目标核心技术栈代码深度解析完整代码工作流程主要功能与优势潜在改进与思考运行结果总结你是否曾经

Python基础文件操作方法超详细讲解(详解版)

《Python基础文件操作方法超详细讲解(详解版)》文件就是操作系统为用户或应用程序提供的一个读写硬盘的虚拟单位,文件的核心操作就是读和写,:本文主要介绍Python基础文件操作方法超详细讲解的相... 目录一、文件操作1. 文件打开与关闭1.1 打开文件1.2 关闭文件2. 访问模式及说明二、文件读写1.

Python将博客内容html导出为Markdown格式

《Python将博客内容html导出为Markdown格式》Python将博客内容html导出为Markdown格式,通过博客url地址抓取文章,分析并提取出文章标题和内容,将内容构建成html,再转... 目录一、为什么要搞?二、准备如何搞?三、说搞咱就搞!抓取文章提取内容构建html转存markdown