pycharm快速开始(英文版).doc

上传人:苏美尔 文档编号:6348291 上传时间:2020-10-31 格式:DOC 页数:24 大小:1.24MB
返回 下载 相关 举报
pycharm快速开始(英文版).doc_第1页
第1页 / 共24页
pycharm快速开始(英文版).doc_第2页
第2页 / 共24页
pycharm快速开始(英文版).doc_第3页
第3页 / 共24页
pycharm快速开始(英文版).doc_第4页
第4页 / 共24页
pycharm快速开始(英文版).doc_第5页
第5页 / 共24页
点击查看更多>>
资源描述

《pycharm快速开始(英文版).doc》由会员分享,可在线阅读,更多相关《pycharm快速开始(英文版).doc(24页珍藏版)》请在三一文库上搜索。

1、Quick Start Guide. Exploring the IDEWelcome to PyCharm! This short guide aims to help you get a grip on the PyCharm IDE.Before you start Make sure that at least onePythoninterpreter, version from 2.4 to 3.4 is properly installed on your computer. Mind that PyCharm is available in two editions: Commu

2、nity and Professional. The difference between the editions is explored inEdition Comparison Matrix.Note that thedownload pagecontains installation instructions for the various platforms; these instructions may vary for the different operating systems.Initial setupIf this is the very first time you l

3、aunch your PyCharm, it will ask you several important questions: First, whether you already have setting you want to preserve (for example, from a previous version) Your license information And, finally, which keymap and theme you want to use:Note that PyCharm has several pre-defined keymaps: for th

4、ose who like Eclipse or Visual Studio, for the Emacs fans, GNOME, KDE and more. Explore the list of available keymaps in theKeymap pageof Settings/Preferences dialog.For the dedicated Vim users, PyCharm suggestsIdeaVim pluginthat helps coding in PyCharm as if in the Vim editor. For those who cannot

5、live without real Emacs, PyCharm provides the possibility touse it as an external editor.If later you decide that your initial choice was wrong, you can always change your settings. To learn more about configuring the IDE theme and keymap, refer to ourdocumentationand tutorials:See also:Getting star

6、ted with PyCharmConfiguring keyboard schemesSetting defaults from the Welcome screenAgain, if this is your very first start (or if you have no open project), youll see theWelcome screen. If you click the link Configure, youll see the page of the Welcome screen that suggests you to configure your env

7、ironment, plugins, import and export settings. You have to click Configure once more - and see theSettings/Preferences dialog. If you look at this dialog, you?ll notice the header Default Project:What does it mean? These settings will be used every time you create a new project. For example, you wan

8、t all you newly created projects to use the same interpreter - OK, you candefine such an interpreterin the Template Project Settings.The IDE settings characterize your working environment (keymaps, color schemes etc.) For example, you want your editor to always show line numbers. In the Settings/Pre

9、ferences dialog, go to the IDE settings, expand the node Editor, and in theAppearance page, select the check box Show line numbers:Next, suppose you want to use some particular color scheme for the editor, and you are not happy with the colors suggested by default. OK, select the base scheme, create

10、 its copy, and then change colors (the schemes suggested by default are not editable).It is also possible to set your preferred font size for the editor - this is done in the Fonts page of theColors and Fonts settings. Again, you have to create a copy of the scheme first, if you havent done it alrea

11、dy, and then specify the desired font size for the editor. This font size will apply to the current editor tabs, and all the newly opened editors. However, it does not affect the font size of the IDE components.Note that you can always see the results of your experiments in the Preview pane:The whol

12、e procedure is described step-by-step in the tutorialWhat my PyCharm looks like.When a project is already created, you can change its settings at any moment. Configuring settings for the current project will be discussed a little bit later, in the sectionCustomize everything for your project!.Finall

13、y, you can show or hide actually all the UI elements: toolbar buttons, main menu, main toolbar (menu View); PyCharm also enables you to choose viewing mode. Refer to the documentation for details:See also:PyCharm tool windowsPresentation and Full Screen viewing modesProjectEverything you do in PyCha

14、rm, is done within the context of aproject. What is most interesting about PyCharm project management, is the possibility toopen multiple projects in one frame. When you create a new project (File New Project), or open an existing one (File Open), PyCharm suggests you to choose which way you want th

15、e project to be opened: in a new window, in the same window after closing the previously opened project, or added to the previously opened project.You can have as many projects opened in one window as required. So doing, the first project is considered the primary project. All the symbols of the add

16、ed projects are visible from the primary project.As an exercise, create a new empty project, where you can develop some pure Python code. This case is discussed in detail in the tutorialGetting started with PyCharm in particular, the sectionCreating a simple project.Types of projectsBy the way, PyCh

17、arm suggests creating projects of the various types: Django, Flask, Pyramid, web2py, etc. You can explore the available types yourself, when creating a new project - just select the new project type from the drop-down list:As you see, PyCharm supports all the major Python-based frameworks. For each

18、of the supported project types, PyCharm creates the corresponding file and directory structure, and all the necessary artifacts. Refer to the product documentation: Django Flask Pyramid Google App Engine Web2PyStarterOK, your project is ready. Before you start working with it, just pressShifttwice.

19、Youll see a pop-up window that allows finding anything and jumping everywhere:As you see, this way one can search among the actions, settings, files, IDE components, and more. Note that it is just one of the numerous navigation features. Well return to the PyCharms search and navigation facilitiesa

20、little bit later.Customize everything for your project!Look at the main toolbar there is the Settings button. Clicking this button opens theSettings/Preferences dialog box, where you can change your project structure, set up version control, and tweak your working environment to make the development

21、 process a real pleasure.Some of the settings pertain to a particular project for example, project interpreter, version control configuration, or file colors. The others like the Editor settings, keymaps, or live templates pertain to your whole working environment, and thus can be configured even wi

22、thout an open project.Project interpreterPython interpreter is vital without it you will not be able to do anything. PyCharm will warn you, if you manage to create a project without an interpreter:In PyCharm, you can define several Python interpreters - they just comprise the list of interpreters, a

23、vailable on your machine. From among them, you can choose the one to be used in your project.You need to tell PyCharm which Python interpreter you want to use since it canuse a different interpreter for each project:PyCharm will use this information for indexing.You can use Python interpreters of th

24、e following types: Local Remote Virtual environmentsLocal interpreterThis is the most straightforward way of using an interpreter. You download a Python interpreter, install it on your machine, and then specify the Python executable. Refer to thetutorialorproduct documentation.Remote interpreterWith

25、 PyCharm, you can use interpreters located remotely, for example, on a reliable server. So doing, PyCharm makes it possible to configure remote interpreters viaSSH connection, or viaVagrant box.Refer to the tutorialConfiguring interpreters with PyCharm.Virtual environmentWhy do we need it all? Suppo

26、se, you are working on one project that makes use of, say, Django 1.6, and at the same time support another project requiring Django 1.2. In such a case, you need something that keeps your environment safe and consistent - a tool that allows creating an isolated working copy of a Python interpreter.

27、 Learn how to create a virtual environment in thedocumentationandtutorial.Packages and pathsRegardless of the interpreter type, PyCharm helps install and update the necessary packages and paths. For example, when PyCharm automatically detects that some of the required packages are missing or outdate

28、d, it suggests you to install or upgrade them:Same thing happens with the paths. If you have installed or upgraded libraries, it is a good idea to rescan the Python installation. Click the gear buttonlocated to the right of the project interpreter field, and chooseMore. Then, in the Project Interpre

29、ters dialog, select the interpreter you want to view the paths for, click, and then, in the Interpreter Paths dialog, refresh packages:Find details in theproduct documentation.VCSSurely, you keep your sources under a version control, right? Git? SVN? Mercurial? With PyCharm, its easy to set up, and

30、again the IDE does a good job auto-detecting the VCS already used for existing projects.But you can fine-tune just clickVersion Controlnode in theSettings/Preferences dialog(Project SettingsVersion Control). By default, you will see project root directory only, but you can break your application dow

31、n into smaller chunks, and place virtually every directory under its own version control system.In theSettings/Preferences dialog, you can also define some behaviors that are common to all version control systems: confirmation on creating or deleting files, tasks performed in the background, ignorin

32、g unversioned files and more.Refer to the tutorials: Version control basics Using PyCharms Git integration locally Sharing via a remote repositorySee also:Version control with PyCharmVersion control proceduresFile colorsYour project might contain several sites, each one with its own set of files wit

33、h the same names (init.py, models.py, tests.py, views.py). When they are opened in the editor, its rather confusing. How can one tell which site they belong to? PyCharm helps make them stand out by painting their editor tabs (Settings/PreferencesProject SettingsFile Colors). Break down your project

34、into smaller chunks scopes (for example, a scope per site), and select a color for each one.Refer to the pageConfiguring scopes and file colorsfor details.IDE and EditorWorking in an IDE actually means living in it, and it is quite natural to make your haunted place pleasant for your eyes and comfor

35、table for your fingers. Thats why PyCharm makes it possible to choose look and feel of the IDE and the editor, configure your preferred set of keyboard shortcuts (keymap), fine-tune scrolling behavior, highlighting, and more.It is recommended to familiarize yourself with the matter in the documentat

36、ion: Project and IDE settings Configuring IDE settings Configuring project settingsAll these settings are (again) configured in theSettings/Preferences dialog: click, and see the list of pages under the IDE Settings heading. Here are three pages that might be of interest for the starter:Appearance,E

37、ditor, andKeymap.AppearanceRemember, youve initially selected the look and feel for your IDE on the first start? If you are not happy with the result, now its time to change your mind. In the pageSettings/PreferencesIDE SettingsAppearanceyou can select look and feel of your PyCharm installation. Jus

38、t click the Look and feel drop-down, and select the scheme you like better. You dont need to close theSettings/Preferences dialogdialog to observe the results of your experiments: clickApply, see what happens, and close the dialog when you are quite happy with what youve got.Refer to the tutorialHow

39、 do I choose look and feel for my PyCharm?, and to theproduct documentation.EditorThe whole bunch of pages under theEditornode (Settings/PreferencesIDE SettingsEditor) helps you tune every aspect of the editors behavior. Note that PyCharm comes with the predefined color scheme, but if you want to ma

40、ke up something very personalized, you are welcome to do it: save the default scheme with a new name, and start changing its background, font, colors of syntactical elements, error highlighting etc., and immediately observe results in the preview pane.Refer to the tutorialHow do I change color schem

41、e of the editorand to theproduct documentation.KeymapThe set of keyboard shortcuts you work with is one of your most intimate habits - your fingers remember certain combinations of keys, and changing this habit is rather painful. With this in mind, PyCharm supplies you with a wide range of pre-defin

42、ed keymaps (Settings/PreferencesIDE SettingsKeymap), for those who prefer Eclipse, or for those whove had long experience with Visual Studio. You can create your very own keymap on the base of an existing one.And finally, there is a magic shortcutCtrl + Back Quotethat helps you switch between scheme

43、s (all of them keymaps, colors, code styles, and L&F) without the Settings dialog (for Windows and Linux users only).Refer to the tutorialConfiguring keyboard schemes, and to theproduct documentation.External editorThough you can choose any keymap that corresponds to your preferred editor (Emacs, Vi

44、m, TextMate, etc), you might still want to open files in your preferred editor. You can easily do it by configuring an external tool. For example, you might want to open a current file in Emacs as an external tool.Refer to the tutorialUsing Emacs as an external editorfor details.Background tasksSome

45、times, when a long task is in progress, PyCharm shows a Progress bar. You can bring such a task to the background, but still see how it goes on. Refer to pageWorking with Background Tasksfor details.Write code smartly!What makes PyCharm stand out from the numerous IDEs, is itsfull-featured editor. W

46、hatever you do for developing your source code, PyCharm is always at hand, helping you create error-free applications. Here is a brief outline of the smart PyCharms coding assistance: At every stage of development, usecode completion(Ctrl+Space), which takes into account the current context. For exa

47、mple, depending on the place where you invoke code completion, you can complete keywords or code blocks, infer types, or complete methods and properties.Refer to the tutorialCode completionand to theproduct documentationfor details. Use live templates/snippets (Ctrl+J) or surround templates (Ctrl+Al

48、t+J) to produce entire code constructs. PyCharm comes with a wide range of ready-to-use live templates, or snippets, which you can explore in the Settings/Preferences dialog (IDE Settings Live templates).If you see that you are lacking something especially important for your development goals, extend this set of snippets with your own ones. Dont also miss the possibility to surround with complete code constructs (Ctrl+Alt+T). Refer to the tutorialCreating and applying live te

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1