Welcome to click on the upper right corner to follow the editor. In addition to sharing technical articles, there are many benefits. You can receive learning materials through private messages, including but not limited to Python practical exercises, PDF electronic documents, interview highlights, learning materials, etc.
1, pycharm settings
Generally, we will make some settings on pycharm for the first time, which can be adjusted according to personal needs. Here are some descriptions of my own settings:
Enter the settings from the setting under file, as shown in the figure below:
Then we enter the setting interface, first we can set the style of the interface and the font size of the toolbar, as shown by the red line
Next, we generally set the font style when writing code, and choose the appropriate font, size, and interval, which is conducive to a comfortable mood when writing programs, and it is easy to write. . .
Next we need to specify our encoding form, which is conducive to our code compilation and writing
After all, the utf-8 coding mode conforms to the coding habits of the Chinese, and then we hope that every time we write code, we can write some information about this file in the file header, such as time, compiler, etc., so that we can write a writing
template, so that every time a new file is created, this information will be automatically added to the file header for us. Here we take the py file as an example, and we can write it according to this mode
For convenience, I will say that they are typed out directly, and can be copied directly!
#!/usr/bin/env python# -*- coding: utf-8 -*-# author: albert time:${DATE}
The next step is the highlight, we need to specify the compiler, this is the soul operation,
Since my python is installed with anaconda, it is enough to directly specify the python path under anaconda here. If you want to load other compilers, you can click show all below and load them in.
2, pycharm use and shortcut keys
In pycharm, you can load the third-party library used by python, just click the plus sign on the right after specifying the compiler, enter the search box to find the third-party library you want to load, but this method is too slow, generally we are in The terminal is installed with pip combined with the image, so it will not be described in detail here.
As for the shortcut keys, different versions may be slightly different, and the commonly used ones are:
- Comment: After selection, Ctrl + /
- Positioning: Ctrl + left mouse button
- Indentation: Tab / Tab+shift
- Line break : shift + enter
- Compile: Ctrl+shift+F10
- View path: ctrl+l (or enter pwd in the terminal)
I can't remember the others, you can check it in the settings
3. Some problems encountered in the use of pycharm
(1) Sometimes when we are writing code, we may find that some tildes (non-coding errors) appear below the code. The quick solution is to click in the lower right corner of the interface to lower the highlighting level to a syntax error.
The root solution is to remove the detection option in pycharm in the settings, but it is not recommended, I use the former.
(2) Unable to compile when running the code
Generally, if we want to run the code, we can run the current file with the right mouse button, but sometimes the following situation occurs
All we need to do is to change the name of the py file.
pycharm set background image
Well, I will write here first today, we can exchange and learn from each other if necessary.
Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/The%20best%20IDE%20for%20Python%20Pycharm%20uses%20a%20summary%20of%20tips%20to%20make%20you%20write%20code%20more%20comfortably.html
评论列表(196条)
测试