[Python Basics] How to use pycharm

1. Set up the Python interpreter

In any project, the first step is to set up the Python interpreter, which is Python.exe

Find Project Interpreter under File->Setting->Projec: xxx. Then modify it to the Python interpreter you need. Pay attention to this place: When choosing a Python interpreter, you must choose the python.exe file, not the python installation folder.

There is python.exe with anacodna set in RunsenPycharm, there is remote python.exe, and there is python.exe for direct download

Let’s not talk about local and anaconda, it’s too simple, let’s talk about how to remote virtual machine, connect to Docker, maybe Xiaobai doesn’t even know what Docker is, let’s talk about it later

1.1 Remote configuration

Pycharm setting remote should be when using Django project,


In fact, it is very simple, I take my Centos7 ip is 192.168.9290

password for username

Then there are two things in the configuration

insert image description here

insert image description here

When Deployment appears, it means OK.

insert image description here

2. Adjust the font and its size

2.1 Adjust the editor font and its size

All the positions are in the Settings, where to see the picture

2.2 Adjust the font and size of the console

3. Set the encoding

4. Modify the background color of the file

5. Set up Git and Github

5.1 configure git

Git location
insert image description here

5.2 Configure GitHub

Now you can upload the code to github

Insert image description here

The last code to Github's Commit

insert image description here

5.3 Download warehouse content


6. Add information by default when creating a new .py file

6.1 Click the file in the upper right corner of pycharm and the following picture will appear and click settings:

6.2 The next step is to find the place as shown below:

insert image description here

6.3 Add the content that will be added by default after you want to create the file. The following is the specific format of the edited content:

Predefined variables are to be expanded to corresponding values ​​in the format ${<variable_name>}.

The available predefined file template variables are:

${PROJECT_NAME} - The name of the current project.

${NAME} - The name of the new file as specified in the New File dialog during file creation.

${USER} - The current user's login name.

${DATE} - The current system date.

${TIME} - Current system time.

${YEAR} - The current year.

${MONTH} - The current month.

${DAY} - The current day of the month.

${HOUR} - The current hour.

${MINUTE} - The current minute.

${PRODUCT_NAME} - The name of the IDE where the file will be created.

${MONTH_NAME_SHORT} - First 3 letters of month name. Example: January, February, etc.

${MONTH_NAME_FULL} - full name of the month. Example: January, February, etc.

7. Recovery code

If you delete the code by mistake, don't be afraid

insert image description here

8. Code wrapping

If you write a lot of code, you can use Soft–Wrap to wrap automatically

9、Reformat Code

The written code is not good-looking enough, directly Reformat

insert image description here

10. Connect to the database

  • Host: remote ip If you connect to local MySQL, just write localhost directly
  • Database: Fill in the database name, after not writing the default connection, you can view all databases under the current user authority
  • User: MySQL user name
  • Password: MySQL password

Note: The driver needs to be downloaded for the first connection, click Download in the lower left corner to download

After the download is complete, click test connection, the test connection is successfully displayed Successful Details

11、 Debug

The previous information can be displayed

12. PyCharm common shortcut keys

Familiar with the shortcut keys of each editor can greatly improve your work efficiency.

Summarize

Here is the daily use of Pycharm, the key is to practice constantly.

In order for Baozi who just started to get in touch with python to learn better, I have prepared a lot of free video tutorials, PDF e-books, and source codes here! Just pick up the business card at the end of the article!

Supongo que te gusta

Origin blog.csdn.net/yxczsz/article/details/128637553
Recomendado
Clasificación