Pycharm用户手册:https://www.jetbrains.com/help/pycharm/quick-start-guide.html
editions comparison matrix
之前都用的vscode,初次接触pycharm,以免费的社区版为例,将用户手册中的一些内容搬运一些以便之后查阅

key map

Ctrl+Alt+T: quickly surrounding your code with complete constructs
Shift+F10: Run
Shift+F9: Debug
Ctrl+/: Comment and Uncomment Blocks of Code
Ctrl+点击模块名等: 查看源码
Shift+Enter: 换行
Ctrl+Shift+ - : 将文件内的所有代码块全部折叠

Ctrl+F: find and replace any fragment of code in the currently opened file
Ctrl+Shift+F: find and replace any fragment of code in the currently opened file
Alt+F7: full-scale search via Find Usages
Double Shift: Search Everywhere

Get started

Step 1. Open/Create a project in PyCharm

Open an existing project

Python工具篇(二):Pycharm简介

It is also possible to drag an existing project directory or a separate file to the Welcome screen, and open it in PyCharm.

Check out an existing project from Version Control

Python工具篇(二):Pycharm简介

Create a project from scratch

Python工具篇(二):Pycharm简介

  • 最上面的Location为工程存放的地址
  • New environment选项是创建一个新的虚拟环境,其中的Location为新的虚拟环境的存放地址,Conda executable路径选择如图所示
  • Existing Interpreter中的Interpreter选择anaconda安装地址中的python解释器

Creating a Python file

Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介

Configure project interpreter

When you configure a project Python interpreter, you need to specify the path to the Python executable in your system. You can create several project interpreters based on the same Python executable. This is helpful when you need to create different virtual environments for developing different types of applications.
Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介
创建完成之后使用命令行查看,确实新建了一个虚拟环境
Python工具篇(二):Pycharm简介

Step 2. Look around

Terminal, Python console

可以看到在左下角有一个很小的图标:
Python工具篇(二):Pycharm简介
将鼠标悬浮在上面,可以看到可以开启以下窗口:
Python工具篇(二):Pycharm简介
其中就包括了Python终端以及默认**了工程所用虚拟环境的命令行窗口:
Python工具篇(二):Pycharm简介

Python工具篇(二):Pycharm简介

TODO (to do)

Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介
双击即可回到上次写的TODO位置

copy file path

Python工具篇(二):Pycharm简介

Step 3. Customize your environment

Appearance

Python工具篇(二):Pycharm简介
在这里选择Pycharm的颜色主题。这里还是选择护眼的黑色吧。

Editor

Python工具篇(二):Pycharm简介

Code style

Python工具篇(二):Pycharm简介

Step 4. Generate some code

consider quickly surrounding your code with complete constructs(Ctrl+Alt+T)
Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介

Step 5. Find your way through

Basic search

You can find and replace any fragment of code both in the currently opened file Ctrl+F, or in an entire project Ctrl+Shift+F.

Search for usages

To find where a particular symbol is used, PyCharm suggests full-scale search via Find Usages Alt+F7:
Python工具篇(二):Pycharm简介

Project navigation

Python工具篇(二):Pycharm简介

Search Everywhere

click the magnifying glass button in the upper right-hand corner of the window, or invoke it with Double Shift (press Shift twice).
Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介

Step 6. Run, debug and test

Run / Debug

Run: Shift+F10 Debug: Shift+F9
Python工具篇(二):Pycharm简介

Run configuration

When you perform run, debug, or test operations with PyCharm, you always start a process based on one of the existing run/debug configurations, using its parameters.

When you run your application for the very first time, PyCharm automatically creates the temporary Run/Debug configuration. You can modify it to specify or alter the default parameters and save it as a permanent Run/Debug configuration.
Python工具篇(二):Pycharm简介
For example, if you want to run some script before/after the build phase, you can do this easily by creating an external tool:
Python工具篇(二):Pycharm简介

Step 9. Keep your source code under Version Control

more detailed information

VCS

PyCharm integrates with many popular version control systems: Git (or GitHub), Mercurial, Perforce (supported in Professional edition only), Subversion.
Python工具篇(二):Pycharm简介

Local history

In addition to traditional version control, you can use the local history. With Local History, PyCharm automatically tracks changes you make to the source code, the results of refactoring, and so on

Local history is always enabled.

Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介

Configuring PyCharm settings

In PyCharm, you can configure the settings on two levels: the project level and globally.
Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介

Restore IDE settings

restore the defaults

Python工具篇(二):Pycharm简介

restore your settings from backup

When you restore the default IDE settings, PyCharm backs up your configuration to a directory.
Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介

Manage plugins

Python工具篇(二):Pycharm简介
因为之前也没用过Pycharm,先在网上随便找了几个听说好用的插件试试看
参考地址:
https://blog.csdn.net/stormdony/article/details/90261391
https://zhuanlan.zhihu.com/p/98096152

Material Theme UI

Mongo Plugin

Markdown support

Markdown Navigator(Paid)

Key Promote X

Json Parser

Rainbow Brackets

.ignore

Compare files

Compare two files

  1. Select the files you want to compare in the Project tool window.
  2. From the context menu, choose Compare Files, or press Ctrl+D.

You can also select one file, choose Compare With from the context menu, and select a file that is outside your project.

Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介

Compare active editor with Clipboard

Right-click anywhere in the editor and choose Compare with Clipboard from the context menu.
Python工具篇(二):Pycharm简介

Compare active editor with a project file

  1. Right-click the file you want to compare with the currently opened file in the Project tool window.
  2. Choose Compare File with Editor from the context menu.

File encoding

Configure encoding for a directory or a file without built-in encoding information

Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介

Change encoding of a single file that doesn’t contain explicit encoding

Python工具篇(二):Pycharm简介

Change encoding of a project

Python工具篇(二):Pycharm简介
Python工具篇(二):Pycharm简介

File and code templates

Python工具篇(二):Pycharm简介
这样的话之后每次新建python文件时,这几行就会出现在新文件的开头

相关文章: