This article has been uploaded to personal Github repository: Cs-docs
Welcome to Star, Fork
1. Introduction
In the last article, we introduced Python, showed you how to install the Python interpreter, and recommended Pycharm, a Python developer.
Today, we will look at how to install and configure this artifact, so that our work efficiency further improve! The content of this paper is arranged as follows:
- Pycharm installation
- Pycharm configuration
- Pycharm plug-in
- How to write a program with Pycharm
2. Pycharm installation
This part mainly describes how to install Pycharm. This article uses macOS installation as an example. Please wait for other systems to install Pycharm when you are free, 😂.
The difference between the community version and the professional version is no longer said, normally speaking, we choose the community version is enough, but because I have a professional version of the account, so the following or to the professional version as an example to install, but we do not have to worry, the installation process is the same.
- First go to the official website to download the installation package;
- Double click download ok
.dmg
The installation package;
- Drag the icon to the right
Applications
Can;
- Ok, that’s it. Our Pycharm is already installed, just go to the launcher and open it;
3. The Pycharm configuration
3.1 Font and theme Settings
Open Customize -> All Settings -> Appearance & Behavior -> Appearance, and select your favorite theme and font on the right, Jetbrains Mono is a font designed by Jetbrains. For size, choose your favorite number.
The font and theme of the IDE interface are set above, and the font and theme of the code editor are set below.
Open Customize -> All Settings -> Editor -> Font and set the Font and size according to your preferences.
Open Customize -> All Settings -> Editor -> Color Scheme and select your favorite theme.
3.2 Coding Settings
Generally speaking, the default encoding for macOS is UTF-8, but not for Windows, so you need to set it.
Open Customize -> All Settings -> Editor -> File Encodings and set everything in the right border to UTF-8.
3.3 Development template Settings
Templates are a common format. If you set the templates in Pycharm, they will be automatically included when you create a Python file.
Open Customize -> All Settings -> Editor -> File and Code Templates, select Python Script, and fill the right border with your own custom Templates. The same is true if you want to set templates for other files.
Then each time we create a Python file in the future, the template content above will be pre-defined.
3.4 plug-in
Although Pycharm is already 🐂🍺, it also has the advantage of being able to extend plug-ins. We can make Pycharm even more fun to use with the plugin. If we compare Pycharm to the hero in King of Glory, then the plugin is like a red and blue Buff that makes our hero even better. Next, let me recommend a few plug-ins that I often use.
First, if we’re going to use plug-ins, we need to know how to install them.
Go to Customize -> All Settings ->Plugins and type in the right box to search for the desired plug-in. When you find the result, click Install.
- Rainbow Brackets
Rainbow, as the name suggests, is all you need to do to highlight your code blocks. You may already be confused by the number of parentheses in your code, but with this you don’t have to worry about it anymore.
- Material Theme UI
The Material Theme UI is a plug-in for JetBrains IDE (IntelliJ IDEA, WebStorm, Android Studio, etc.) that changes the original look to the Material Design look. Originally inspired by Sublime Text’s Material Theme, this plugin provides a full set of Settings to tweak your IDE the way you want to make it look even pretter!
- Key Promoter X
Key Promoter X helps you learn the necessary shortcuts while you work. When you use the mouse on the buttons in the IDE, the Key Promoter X will display the keyboard shortcuts that you should use.
- CodeGlance
Code minimaps like those in Sublime are embedded in the editor pane and can be used to quickly locate code;
- leetcode editor
As a programmer, how can you forget to brush questions when you are at leisure? This plugin allows you to directly open Leetcode questions in Pycharm. Even if you want to touch the fish during working hours, others will not be able to see that you are brushing questions.
4. Write your program with Pycharm
Now that you’ve done the above steps, you can use Pycharm to write your program. In this section, we will show you how to use Pycharm to create the simplest Hello World!
- First, click on the home screen
New Project
;
- Then set the project location and configure the Python interpreter, and click on the lower right corner
Create
Button;
- At this point our project has been created, but at this point it is 🈳️ and has nothing, so we need to create a Python script to store our code. Click the right mouse button on the item and click in sequence
New -> Python File
;
- Fill in the name of your script, ⚠️ although it is not clear that can not use Chinese, but it is best not mainstream, old honest practical English is good;
- Now that the script file is set up, it’s time to write the code;
- In the code edit area or select the current script file, right-click to run, or you can use shortcut keys
Ctrl + Shift + F10
Run;
5. To summarize
Here are the tips on Pycharm installation and configuration and how to use Pycharm. You are welcome to leave comments and discuss more advanced and interesting ways to use Pycharm. You are also welcome to join my communication group and talk with everyone!