Basic chapter – installation and use of pychar for beginners. This chapter is enough

Time:2021-10-21

brief introduction

Pychart is one of the most recommended editing and debugging software in Python programming. It is simple to use and has a friendly interface. It has also become one of the software that must be learned on the way to learn python. This tutorial briefly introduces the basic functions of Windows users from installation to daily use, and other systems can also be used for reference.

Software installation

  1. Python installation
    Pychart is used as a python editing and debugging tool, so first ensure that Python can be installed and used normally. However, python installation is not within the scope of this tutorial. Here is an exampleDirect elevator on official website
    Download elevator version 3.10 from the official website
    在这里插入图片描述

You can download and install the appropriate version according to your computer configuration. Generally, you can use the recommended version
This tutorial uses Python 3.9 as a demonstration

  1. Pychart software is available. It is recommended to download it directly from the official website,Download the link here
    在这里插入图片描述

Ordinary users can download the community version. Of course, it is highly recommended to use the professional version, but they need to pay or use other methods (you know). The professional version has advanced functions such as remote debugging, which will be explained in other tutorials. This article mainly explains the basic functions of the community version.

  1. Pycham installation
    After downloading the installation package according to step 2, double-click the file and continue to select the next step according to the prompt to complete the installation. Some options are as follows:
    在这里插入图片描述

You can refer to the explanation for this step. Check it all

  1. Pychart run configuration
    4.1 start pycharm and you will see the import settings pop-up window. Pycharm will automatically detect that this is the first installation and select the “do not import settings” option for you. Click OK
    在这里插入图片描述

    After 4.2, pycharm will let you select the keyboard map scheme. Keep the default settings and click “next: * * *” in the lower right corner
    在这里插入图片描述
    4.3 directly click [start using pycharm] to start programming
    在这里插入图片描述

  2. Create first project
    5.1 click [new project]
    在这里插入图片描述
    5.2 configure the project directory and select the interpreter
    在这里插入图片描述

In this step, the new environment virtual environment is selected by default, but in this way, a copy of the python environment will be copied as the virtual environment. The advantage is that different interpreters and python packages can be configured for different projects. The disadvantages are obvious and more space will be occupied. Moreover, for novices, there are many Python environments, but it is very messy. It is better to use a common Python interpreter and library package, So I recommend using an existing interpreter first.

5.3 select system interpreter
在这里插入图片描述

This step depends on the python installation in step 1. If Python is installed and the environment variables are configured, this step will automatically identify the path of the system Python interpreter. Otherwise, check the python environment variable configuration and try again, or manually select the Python interpreter path.

5.4 select OK, the new interface is as follows, and select [create]
在这里插入图片描述
5.5 the pop-up interface is as follows. So far, the first runnable project has been created. By default, a main.py is created, which is a routine that outputs “pycharm”.
在这里插入图片描述

Operation and commissioning

1. We directly click the run button in the upper right corner
在这里插入图片描述
在这里插入图片描述

You can see that hi and pycharm are directly output here. The first line here is the path of the Python interpreter and the path of the execution file, and the second line is the output content

On this basis, we add a sentence to output “Hello, word” for testing
在这里插入图片描述

You can see this step. When we type characters, we will be prompted with functions such as automatic completion. This is because pycharm provides intelligent coding assistance function, which can perform code completion, code inspection, error highlighting and quick repair suggestions. For example, if you type main and click the tab key, pycharm will automatically complete the whole main clause.
In addition, if you forget to type if before the conditional sentence, add. If at the end of the sentence and click tab, pycharm will fix the if conditional sentence. If you type. Print after the content that needs to be printed, it will also automatically move the print to the beginning of the sentence and enclose the content to be output in parentheses. This usage is also applicable to true.while. This is the postfix completion function of pycharm, which can help users reduce the number of backspace keys.

3 Click run in the upper right corner to see the output of the content we just added
在这里插入图片描述
4 commissioning and single step execution
In the process of programming, it is often necessary to execute the program step by step. Let’s demonstrate it here
在这里插入图片描述

Here, we first click the blank space next to the line number with the mouse to add a breakpoint, and then click the debug icon in the upper right corner
在这里插入图片描述
Then, if you need to see the variables, select the default debugger window below. If you need to see the output, select the console window. Here, we select console, and then select a series of options, such as step into single step execution into the subroutine, or step over execution after this step. You can select it.

5 subroutine view
在这里插入图片描述

Click the structure button to pop up this window, which is used to display the structure of the current file. It is very convenient and efficient for viewing large files such as API manuals

6 program jump: hold down Ctrl + click the variable or function name to jump to the definition. However, the premise of this function is to install the package through the PIP tool, or place the file in the same directory as the current program. If it cannot jump normally, you need to check whether the installation package is correct. If it is a third-party library file, there is no installation file, You can also directly put the. Py file into the current programming directory to identify, jump and complete it.

7 project configuration
Almost all configurations will be set using the following menu, which is very important. After entering this page, the vast majority of project related configurations can be found here. Due to the variety of functions, they will not be explained in detail here. Generally, the commonly used functions are to modify the interpreter path, modify the main topic, font, software background and other functions. You can explore them by yourself
在这里插入图片描述

epilogue

So far, the introduction function of pycharm has been introduced. Congratulations on learning a new tool.
Of course, pycharm has rich functions, including version management, remote debugging and other advanced functions. You can view the help documents on the official website for in-depth study
在这里插入图片描述

.
.
.
.
Welcome to old fellow tie, and this will continue to update raspberry, AI, STM32 and ROS related articles and knowledge.

You can leave a message at the bottom of the article about the knowledge points you are interested in. I can give priority to explaining it for you

Original is not easy, please explain the source.

Recommended Today

Swift advanced (XV) extension

The extension in swift is somewhat similar to the category in OC Extension can beenumeration、structural morphology、class、agreementAdd new features□ you can add methods, calculation attributes, subscripts, (convenient) initializers, nested types, protocols, etc What extensions can’t do:□ original functions cannot be overwritten□ you cannot add storage attributes or add attribute observers to existing attributes□ cannot add parent […]