Pycharm Basic Tutorials

Source: Internet
Author: User

Pycharm Tutorial (i) Installation and first-time use

Pycharm is one of the more handy python editors I've used. And you can cross-platform, both MacOS and Windows can be used, this is better.

First, preview the Pycharm in the actual application of the interface: (changed the default style of Pycharm)

Installation

First go to download the latest Pycharm 2.7.3 for installation. Can be downloaded directly on the official website.

Activation mode of Pycharm:

1, the recommended purchase of genuine.

2, you can choose trial, free trial for 30 days.

3, find the Activation code online:

(The activation code below is from the Internet for learning and communication purposes only)

User Name:embrace

Key
14203-12042010
0000107iq75c621p7x1sfnpjdivknx
6zcwyoyagk3euo3ehd1mitt "2! Jny8
bff9vctsjk7srdlqkrvz1xgkbmqw3g

First Use

1, click Create New Project.

2, enter the project name, path, and select the Python interpreter. If the Python interpreter does not appear, go to step 3.

3. Select the Python interpreter. As you can see, once the Python interpreter is added, Pycharm will scan the Python expansion pack that you have installed, and the latest version of those expansion packs. (It is estimated that pycharm connected PyPI)

4, after clicking OK, an empty project will be created, containing a. Idea folder for Pycharm management projects.

5, OK, write a new project try Pycharm!

Note

Pycharm style (color scheme) adjustment, can be in: "File" and "Settings" in the editor's sub-options to set.

For example, my color scheme, the choice is Dracula (Count Vampire Dracula), such as:

Pycharm Tutorial (ii) Setting the font size

Pycharm is a very good IDE, under Windows, and MacOS, can run very well. The only drawback is slow start.

The default font size is too small for a Mac to see with a large 24K krypton dog eye. In order to protect the eyes, we need to adjust the font size:

Steps:

Settings-->editor-->colors & Fonts-->font

Then adjust the size there.

Pycharm Tutorial (iii) Hello world!

As the Pycharm editor started, we took it for granted to first write a Hello word and run it. (This article is for beginners unfamiliar with the IDE)

1, create a new project

File-to-New Project ...

2, create a new file

Right-click the newly built Helloword project and choose New---Python File

3, enter the file name

Enter a file name, nothing to say

4, enter the authoring interface

Pycharm's default editing interface is weird and automatically generates a line of __author__ = "Author" header. And more commonly used file headers, such as: #coding =utf-8, and so on, instead of automatically generated.

Enter code:

Print "Hello word!"

5, setting up the console

Before running, we found that the "Run" and "Debug" on the shortcut menu are grayed out and cannot be triggered. Because we need to configure the console first.

Click the black inverted triangle next to run and go to the "Run/debug configurations" configuration screen. (or click Run---Edit configurations also)

In the "Run/debug Configurations" Configuration interface,

Click the green plus sign, create a new configuration item, and select Python. (Because Hello Word is a python program)

In the configuration interface on the right:

A name in the name column, like hello.

Click the SCRIP option to find the hello_word.py we wrote just now

Click OK to automatically return to the editing interface, when the "Run" "Debug" button all turn green!

6, run

Click the Green Run button to view the results of the output:

Ok,pycharm's first show, a successful end!

Pycharm Tutorial (iv) Show line numbers

In Pycharm, there are two ways to display line numbers:

1, temporary settings. Right-click the line number and select Show lines Numbers.

However, this method is only valid for one file and disappears after restarting Pycharm.

2, permanently set. File--and Settings-->editor-->appearance, then tick show line Numbers.

Pycharm Tutorial (v) Breakpoint debugging

Pycharm as an IDE, breakpoint debugging is a must-have feature. Otherwise, we might as well write with the pure editor fast.

"Run" and "Debug" before the settings, see the previous article, Helloword.

1, set breakpoints

At the front of the code, after the line number, you can set a breakpoint by clicking the mouse. As follows:

2, debugging breakpoints

Click on the green Beetle icon (it appears that the beetle has become a debug-only icon) and debug the breakpoint.

When clicked, it runs to the first breakpoint. The variable information before the breakpoint is displayed.

Click Step Over or press F8, and we continue down to the next breakpoint:

Add:

Breakpoints of other operations, and functions, you can move the mouse to the corresponding button, see, try to know. As follows:

Summarize:

This is the breakpoint function of Pycharm, or it is very easy to use.

Pycharm Basic Tutorials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.