初学者python编辑器_Thonny:适合初学者的Python编辑器

初学者python编辑器

Are you a Python beginner looking for a tool that can support your learning? This article is for you! Every programmer needs a place to write their code. This article will discuss an awesome tool called Thonny that will enable you to start working with Python in a beginner-friendly environment.

您是Python的新手,正在寻找一种可以支持您的学习的工具吗? 本文适合您! 每个程序员都需要一个编写代码的地方。 本文将讨论一个名为Thonny的出色工具,使您能够在对初学者友好的环境中开始使用Python。

In this article, you’ll learn:

在本文中,您将学习:

  • How to install Thonny on your computer
  • How to navigate Thonny’s user interface to use its built-in features
  • How to use Thonny to write and run your code
  • How to use Thonny to debug your code
  • 如何在计算机上安装Thonny
  • 如何浏览Thonny的用户界面以使用其内置功能
  • 如何使用Thonny编写和运行代码
  • 如何使用Thonny调试代码

By the end of this article, you’ll be comfortable with the development workflow in Thonny and ready to use it for your Python learning.

到本文结尾,您将对Thonny的开发工作流程感到满意,并准备将其用于Python学习。

So what is Thonny? Great question!

那么什么是通尼? 好问题!

Thonny is a free Python Integrated Development Environment (IDE) that was especially designed with the beginner Pythonista in mind. Specifically, it has a built-in debugger that can help when you run into nasty bugs, and it offers the ability to do step through expression evaluation, among other really awesome features.

Thonny是一个免费的Python集成开发环境(IDE),它是专门为初学者Pythonista设计的。 特别是,它具有一个内置的调试器,可以在您遇到令人讨厌的错误时提供帮助,并且还具有逐步执行表达式求值的功能,以及其他一些非常出色的功能。

Free Sample Chapter: Download a free sample chapter from the Real Python course and gain practical Python programming skills.

免费样本章节: 从Real Python课程下载免费样本章节,并获得实用的Python编程技能。

安装Thonny (Installing Thonny)

This article assumes that you have Python 3 installed on your computer. If not, please review Python 3 Installation & Setup.

本文假定您在计算机上安装了Python 3。 如果没有,请查看Python 3 Installation&Setup

网页下载 (Web Download)

The web download can be accessed via a web browser by visiting the Thonny website. Once on the page, you will see a light gray box in the top right corner like this:

可以通过访问Thonny网站来通过Web浏览器访问Web下载。 进入页面后,您将在右上角看到一个浅灰色的框,如下所示:

Thonny's Web Download Widget

Once you’ve found the gray box, click the appropriate link for your operating system. This tutorial assumes you’ve downloaded version 3.0.1.

找到灰色框后,单击适用于您的操作系统的链接。 本教程假定您已下载3.0.1版。

命令行下载 (Command Line Download)

You can also install Thonny via your system’s command line. On Windows, you can do this by starting a program called Command Prompt, while on macOS and Linux you start a program called Terminal. Once you’ve done that, enter the following command:

您也可以通过系统的命令行安装Thonny。 在Windows上,您可以通过启动一个名为Command Prompt的程序来执行此操作,而在macOS和Linux上,您可以启动一个名为Terminal的程序。 完成此操作后,输入以下命令:

 pip install thonny
pip install thonny

用户界面 (The User Interface)

Let’s make sure you understand what Thonny has to offer. Think of Thonny as the workroom in which you will create amazing Python projects. Your workroom contains a toolbox containing many tools that will enable you to be a rock star Pythonista. In this section, you’ll learn about each of the features of the UI that’ll help you use each of the tools in your Thonny toolbox.

让我们确保您了解Thonny所提供的服务。 将Thonny视为您将在其中创建出色的Python项目的工作室。 您的工作室包含一个工具箱,其中包含许多工具,可以使您成为巨星Pythonista。 在本部分中,您将了解UI的每个功能,这些功能将帮助您使用Thonny工具箱中的每个工具。

代码编辑器和Shell (The Code Editor and Shell)

Now that you have Thonny installed, open the application. You should see a window with several icons across the top, and two white areas:

现在您已经安装了Thonny,打开应用程序。 您应该看到一个窗口,顶部带有多个图标,两个白色区域:

托尼的主界面

Notice the two main sections of the window. The top section is your code editor, where you will write all of your code. The bottom half is your Shell, where you will see outputs from your code.

注意窗口的两个主要部分。 顶部是代码编辑器,您将在其中编写所有代码。 下半部分是您的Shell,您将在其中看到代码的输出。

图标 (The Icons)

Across the top you’ll see several icons. Let’s explore what each of them does. You’ll see an image of the icons below, with a letter above each one. We will use these letters to talk about each of the icons:

在顶部,您将看到几个图标。 让我们探索它们各自的作用。 您会在下面看到图标的图像,每个图标上方都有一个字母。 我们将使用这些字母来讨论每个图标:

Thonny用户界面顶部的图标

Working our way from left to right, below is a description of each of the icons in the image.

下面是从左到右的工作原理,描述了图像中的每个图标。

A: The paper icon allows you to create a new file. Typically in Python you want to separate your programs into separate files. You’ll use this button later in the tutorial to create your first program in Thonny!

答:纸张图标可让您创建一个新文件。 通常,在Python中,您要将程序分成单独的文件。 您将在本教程的后面部分中使用此按钮在Thonny中创建您的第一个程序!

B: The open folder icon allows you to open a file that already exists on your computer. This might be useful if you come back to a program that you worked on previously.

B:打开文件夹图标可让您打开计算机上已经存在的文件。 如果您返回以前使用的程序,这可能会很有用。

C: The floppy disk icon allows you to save your code. Press this early and often. You’ll use this later to save your first Thonny Python program.

C:使用软盘图标可以保存代码。 尽早并经常按此。 稍后将使用它保存您的第一个Thonny Python程序。

D: The play icon allows you to run your code. Remember that the code you write is meant to be executed. Running your code means you’re telling Python, “Do what I told you to do!” (In other words, “Read through my code and execute what I wrote.”)

D:播放图标可让您运行代码。 请记住,您编写的代码是要执行的。 运行代码意味着您要告诉Python,“按照我告诉您的做!” (换句话说,“通读我的代码并执行我编写的内容。”)

E: The bug icon allows you to debug your code. It’s inevitable that you will encounter bugs when you’re writing code. A bug is another word for a problem. Bugs can come in many forms, sometimes appearing when you use inappropriate syntax and sometimes when your logic is incorrect.

E:错误图标可让您调试代码。 在编写代码时不可避免地会遇到错误。 错误是问题的代名词。 错误可能以多种形式出现,有时在使用不当语法时出现,有时在逻辑不正确时出现。

Thonny’s bug button is typically used to spot and investigate bugs. You’ll work with this later in the tutorial. By the way, if you’re wondering why they’re called bugs, there’s also a fun story of how it came about!

Thonny的错误按钮通常用于发现和调查错误。 您将在本教程的后面部分中对此进行处理。 顺便说一句,如果您想知道为什么将它们称为错误,那么还有一个有趣的故事,它是如何产生的!

F-H: The arrow icons allow you to run your programs step by step. This can be very useful when you’re debugging or, in other words, trying to find those nasty bugs in your code. These icons are used after you press the bug icon. You’ll notice as you hit each arrow, a yellow highlighted bar will indicate which line or section Python is currently evaluating

  • 4
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值