pycharm快速开始英文版.docx

上传人:b****5 文档编号:6658296 上传时间:2023-01-08 格式:DOCX 页数:23 大小:1.06MB
下载 相关 举报
pycharm快速开始英文版.docx_第1页
第1页 / 共23页
pycharm快速开始英文版.docx_第2页
第2页 / 共23页
pycharm快速开始英文版.docx_第3页
第3页 / 共23页
pycharm快速开始英文版.docx_第4页
第4页 / 共23页
pycharm快速开始英文版.docx_第5页
第5页 / 共23页
点击查看更多>>
下载资源
资源描述

pycharm快速开始英文版.docx

《pycharm快速开始英文版.docx》由会员分享,可在线阅读,更多相关《pycharm快速开始英文版.docx(23页珍藏版)》请在冰豆网上搜索。

pycharm快速开始英文版.docx

pycharm快速开始英文版

QuickStartGuide.ExploringtheIDE

WelcometoPyCharm!

ThisshortguideaimstohelpyougetagriponthePyCharmIDE.

Beforeyoustart…

∙Makesurethatatleastone Python interpreter,versionfrom2.4to3.4isproperlyinstalledonyourcomputer.

∙MindthatPyCharmisavailableintwoeditions:

CommunityandProfessional.Thedifferencebetweentheeditionsisexploredin EditionComparisonMatrix.

Notethatthe downloadpage containsinstallationinstructionsforthevariousplatforms;theseinstructionsmayvaryforthedifferentoperatingsystems.

Initialsetup

IfthisistheveryfirsttimeyoulaunchyourPyCharm,itwillaskyouseveralimportantquestions:

∙First,whetheryoualreadyhavesettingyouwanttopreserve(forexample,fromapreviousversion)

∙Yourlicenseinformation

∙And,finally,whichkeymapandthemeyouwanttouse:

NotethatPyCharmhasseveralpre-definedkeymaps:

forthosewholikeEclipseorVisualStudio,fortheEmacsfans,GNOME,KDEandmore.Explorethelistofavailablekeymapsinthe Keymappage ofSettings/Preferencesdialog.

ForthededicatedVimusers,PyCharmsuggests IdeaVimplugin thathelpscodinginPyCharmasifintheVimeditor.ForthosewhocannotlivewithoutrealEmacs,PyCharmprovidesthepossibilityto useitasanexternaleditor.

Iflateryoudecidethatyourinitialchoicewaswrong,youcanalwayschangeyoursettings.TolearnmoreaboutconfiguringtheIDEthemeandkeymap,refertoour documentation andtutorials:

Seealso:

GettingstartedwithPyCharmConfiguringkeyboardschemes

SettingdefaultsfromtheWelcomescreen

Again,ifthisisyourveryfirststart(orifyouhavenoopenproject),you'llseethe Welcomescreen.IfyouclickthelinkConfigure,you'llseethepageoftheWelcomescreenthatsuggestsyoutoconfigureyourenvironment,plugins,importandexportsettings.YouhavetoclickConfigureoncemore-andseethe Settings/Preferencesdialog.Ifyoulookatthisdialog,you?

llnoticetheheader"DefaultProject":

Whatdoesitmean?

Thesesettingswillbeusedeverytimeyoucreateanewproject.Forexample,youwantallyounewlycreatedprojectstousethesameinterpreter-OK,youcan definesuchaninterpreter intheTemplateProjectSettings.

TheIDEsettingscharacterizeyourworkingenvironment(keymaps,colorschemesetc.)Forexample,youwantyoureditortoalwaysshowlinenumbers.IntheSettings/Preferencesdialog,gototheIDEsettings,expandthenodeEditor,andinthe Appearancepage,selectthecheckbox"Showlinenumbers":

Next,supposeyouwanttousesomeparticularcolorschemefortheeditor,andyouarenothappywiththecolorssuggestedbydefault.OK,selectthebasescheme,createitscopy,andthenchangecolors(theschemessuggestedbydefaultarenoteditable).

Itisalsopossibletosetyourpreferredfontsizefortheeditor-thisisdoneintheFontspageoftheColorsandFontssettings.Again,youhavetocreateacopyoftheschemefirst,ifyouhaven'tdoneitalready,andthenspecifythedesiredfontsizefortheeditor.Thisfontsizewillapplytothecurrenteditortabs,andallthenewlyopenededitors.However,itdoesnotaffectthefontsizeoftheIDEcomponents.

NotethatyoucanalwaysseetheresultsofyourexperimentsinthePreviewpane:

Thewholeprocedureisdescribedstep-by-stepinthetutorial WhatmyPyCharmlookslike.

Whenaprojectisalreadycreated,youcanchangeitssettingsatanymoment.Configuringsettingsforthecurrentprojectwillbediscussedalittlebitlater,inthesection Customizeeverythingforyourproject!

.

Finally,youcanshoworhideactuallyalltheUIelements:

toolbarbuttons,mainmenu,maintoolbar(menuView);PyCharmalsoenablesyoutochooseviewingmode.Refertothedocumentationfordetails:

Seealso:

PyCharmtoolwindowsPresentationandFullScreenviewingmodes

Project

EverythingyoudoinPyCharm,isdonewithinthecontextofa project.WhatismostinterestingaboutPyCharmprojectmanagement,isthepossibilityto openmultipleprojectsinoneframe.Whenyoucreateanewproject(File→NewProject),oropenanexistingone(File→Open),PyCharmsuggestsyoutochoosewhichwayyouwanttheprojecttobeopened:

inanewwindow,inthesamewindowafterclosingthepreviouslyopenedproject,oraddedtothepreviouslyopenedproject.

Youcanhaveasmanyprojectsopenedinonewindowasrequired.Sodoing,thefirstprojectisconsideredtheprimaryproject.Allthesymbolsoftheaddedprojectsarevisiblefromtheprimaryproject.

Asanexercise,createanewemptyproject,whereyoucandevelopsomepurePythoncode.Thiscaseisdiscussedindetailinthetutorial GettingstartedwithPyCharm —inparticular,thesectionCreatingasimpleproject.

Typesofprojects

Bytheway,PyCharmsuggestscreatingprojectsofthevarioustypes:

Django,Flask,Pyramid,web2py,etc.Youcanexploretheavailabletypesyourself,whencreatinganewproject-justselectthenewprojecttypefromthedrop-downlist:

Asyousee,PyCharmsupportsallthemajorPython-basedframeworks.Foreachofthesupportedprojecttypes,PyCharmcreatesthecorrespondingfileanddirectorystructure,andallthenecessaryartifacts.Refertotheproductdocumentation:

∙Django

∙Flask

∙Pyramid

∙GoogleAppEngine

∙Web2Py

Starter

OK,yourprojectisready.Beforeyoustartworkingwithit,justpress Shift twice.You'llseeapop-upwindowthatallowsfindinganythingandjumpingeverywhere:

Asyousee,thiswayonecansearchamongtheactions,settings,files,IDEcomponents,andmore.Notethatitisjustoneofthenumerousnavigationfeatures.We'llreturntothePyCharm'ssearchandnavigationfacilities alittlebitlater.

Customizeeverythingforyourproject!

Lookatthemaintoolbar—thereistheSettingsbutton 

.ClickingthisbuttonopenstheSettings/Preferencesdialogbox,whereyoucanchangeyourprojectstructure,setupversioncontrol,andtweakyourworkingenvironmenttomakethedevelopmentprocessarealpleasure.

Someofthesettingspertaintoaparticularproject—forexample,projectinterpreter,versioncontrolconfiguration,orfilecolors.Theothers—liketheEditorsettings,keymaps,orlivetemplates—pertaintoyourwholeworkingenvironment,andthuscanbeconfiguredevenwithoutanopenproject.

Projectinterpreter

Pythoninterpreterisvital—withoutityouwillnotbeabletodoanything...PyCharmwillwarnyou,ifyoumanagetocreateaprojectwithoutaninterpreter:

InPyCharm,youcandefineseveralPythoninterpreters-theyjustcomprisethelistofinterpreters,availableonyourmachine.Fromamongthem,youcanchoosetheonetobeusedinyourproject.

YouneedtotellPyCharmwhichPythoninterpreteryouwanttousesinceitcan useadifferentinterpreterforeachproject:

PyCharmwillusethisinformationforindexing.

YoucanusePythoninterpretersofthefollowingtypes:

∙Local

∙Remote

∙Virtualenvironments

Localinterpreter

Thisisthemoststraightforwardwayofusinganinterpreter.YoudownloadaPythoninterpreter,installitonyourmachine,andthenspecifythePythonexecutable...Refertothe tutorial or productdocumentation.

Remoteinterpreter

WithPyCharm,youcanuseinterpreterslocatedremotely,forexample,onareliableserver.Sodoing,PyCharmmakesitpossibletoconfigureremoteinterpretersvia SSHconnection,orvia Vagrantbox.

Refertothetutorial ConfiguringinterpreterswithPyCharm.

Virtualenvironment

Whydoweneeditall?

Suppose,youareworkingononeprojectthatmakesuseof,say,Django1.6,andatthesametimesupportanotherprojectrequiringDjango1.2.Insuchacase,youneedsomethingthatkeepsyourenvironmentsafeandconsistent-atoolthatallowscreatinganisolatedworkingcopyofaPythoninterpreter.Learnhowtocreateavirtualenvironmentinthedocumentation and tutorial.

Packagesandpaths

Regardlessoftheinterpretertype,PyCharmhelpsinstallandupdatethenecessarypackagesandpaths.Forexample,whenPyCharmautomaticallydetectsthatsomeoftherequiredpackagesaremissingoroutdated,itsuggestsyoutoinstallorupgradethem:

Samethinghappenswiththepaths.Ifyouhaveinstalledorupgradedlibraries,itisagoodideatorescanthePythoninstallation.Clickthegearbutton 

 locatedtotherightoftheprojectinterpreterfield,andchoose More.Then,intheProjectInterpretersdialog,selecttheinterpreteryouwanttoviewthepathsfor,click 

andthen,intheInterpreterPathsdialog,refreshpackages 

:

Finddetailsinthe productdocumentation.

VCS

Surely,youkeepyoursourcesunderaversioncontrol,right?

Git?

SVN?

Mercurial?

WithPyCharm,it'seasytosetup,andagaintheIDEdoesagoodjobauto-detectingtheVCSalreadyusedforexistingprojects.

Butyoucanfine-tune—justclick VersionControl nodeinthe Settings/Preferencesdialog (ProjectSettings→VersionControl).Bydefault,youwillseeprojectrootdirectoryonly,butyoucanbreakyourapplicationdownintosmallerchunks,andplacevirtuallyeverydirectoryunderitsownversioncontrolsystem.

Inthe Settings/Preferencesdialog,youcanalsodefinesomebehaviorsthatarecommontoallversioncontrolsystems:

confirmationoncreatingordeletingfiles,tasksperformedinthebackground,ignoringunversionedfilesandmore.

Refertothetutorials:

∙Versioncontrolbasics

∙UsingPyCharm'sGitintegrationlocally

∙Sharingviaaremoterepository

Seealso:

VersioncontrolwithPyCharmVersioncontrolprocedures

Filecolors

Yourprojectmightcontainseveralsites,eachonewithitsownsetoffileswiththesamenames(init.py,models.py,tests.py,views.py).Whentheyareopenedintheeditor,it'sra

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

当前位置:首页 > 高等教育 > 艺术

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1