installing python and eclipse on your pc · click down pydev > interpreters > python...
TRANSCRIPT
InstallingPythonandEclipseonyourPCYourfirsttaskforthecourse:getyourcomputerupandrunningwithPython!SomeinstallationinstructionsforbothMacOSandWindowsfollowbelowifyouneedthem.Ifyou’rerunningLinux,youdon’twantinstructionsJ.WewillbecodinginPython3forthiscourse–unlessyou’realreadyaPython2whizorfeelastrongdesiretoconfuseyourselfandyourinstructors,makesureyou’reworkingwiththisversion(any3.x.xshouldbefine–mostrecentis3.7.3asofJune).Similarly,thestronglysuggesteddevelopmentenvironmentforthiscourseisEclipse,butifyoupreferanotherIDEortexteditorbasedonyourpreviousexperience,that’syourbusiness.Havingdifficultiesinstallingwiththeseinstructions?Rule#1:trytroubleshootingyourselffirst!Asyouprobablyknow,learningtodiagnoseproblemsandtrackdownothers’solutionsonGoogle,StackExchangeorotheronlinecodingforumsisaveryvaluablelearningprocess.Thiskindofabstractproblemsolvingisthemainjobdescriptionformanycoders/analysts/datascientists!Ofcourse,ifyou’restillhavingissuesaftergivingityourverybesttry,feelfreetosendanemailandwe’llhelpyougetsetup!
A. PythoninstallationonMacOS:MacOSXhasPythonversion2.7“outofthebox,”butwewillusePython3inthiscourse.Todownloadit,startatthiswebsite:https://www.python.org/downloads/.
1. ClickontheMacOSXdownloadlinkforPython3.7.3.
2. Oncedownloaded,runthepackageInstaller.ClickContinuethroughallscreens,acceptinglicensesagreementsasrequired.Finally,clickInstall.
3. That’sit!Python3shouldbefunctional.Ifyouwanttotestthis:
a. OpenMacOS’sTerminalandissuethecommandpython3--version,asshown
below.IfthereturnisPython3.7.3,yourcomputerrecognizesthenewversion.
b. Nexttypepython3toopenaPython3shell.
c. Whentheshellisopen,typeprint(“HelloWorld!”).Iftheterminal’sreturnis
HelloWorld,you’regoodtogo(andasalwaysyoushouldappreciatethatyourcomputeristalkingtoyou:))
d. ToexitthePythonshellinterminal,typeexit().
B. InstallingPythononWindows:WindowsdoesnottypicallycomewithPython3included,sowewilldownloadandinstallit.Todownload,tohttps://www.python.org/downloads/release/python-373/.
1. Youshouldknowwhetheryourcomputerisrunning32-or64-bitversionof
Windows.Ifyoudon’tknowthis,youcanfigureoutbyfollowingthedirectionsgivenatthiswebsite.
i. Ifyou’rerunning64-bit,onthePythonwebpage,clickonthelinkto
DownloadWindowsx86-64executableinstaller.
ii. Ifyou’rerunning32-bit,onthePythonwebpage,clickonthelinktoDownloadWindowsx86executableinstaller.
2. Double-clickthedownloaded.exefile.Youshouldbeatascreenthatlookslikethe
onebelow.
i. TakecarefulnoteofthefileaddresslistedbelowthelinktoInstallNow.ThisiswhereyourcomputerwillstorePython3.YouwillneedtoknowthisfileaddresstointegratePythonandEclipse(orotherIDEs).
ii. ChecktheboxnexttoAddPython3.7toPATH,thenclickInstallNow.Ifafollowupcontrolwindowasksyoutoallowchangestothecomputer,clickYes.
iii. WewillinstallPythonwithdefaultsettings,sononeedtochangeanything
elserightnow.
3. Waitfortheprogramtoinstall.Ifallgoeswell,awindowshouldpopupandtellyouSetupwassuccessful.Pythonwasinstalled.
4. Totestthis,openyourCommandPromptfromyourStartmenu.Typepython3--versionintotheinitialcommandline(>).IftheresultcomesbackPython3.7.3,youhavethemostrecentversion.
5. Next,typepythonintothecommandline.OncePythonisopenedintheprompt,trytypingsomemathematicalexpressionsintothe(>>>)commandline(i.e.somethinglike3*5or5876+23).Ifthecomputer’sresponsecomesbackcorrectly,Pythonisinstalledandreadytogo.Typeexit()intothecommandlinetoclosePython.
C. InstallingEclipse(similarforMacandWindows)ToobtaintheEclipsedesktopplatform,startatthiswebsite:https://www.eclipse.org/downloads/packages/installerTherearesomeinstructionsforinstallationontheEclipsewebsite,butherearesomemoredetailedhighlights:
1. DownloadtheEclipseInstallerfilethatisappropriateforyouroperatingsystem.
2. Unzipthefile(ifneeded)andstarttheInstalleronceitisavailable.
3. Ifyougetamessagesaying“TouseJavacommand-linetools,youneedtoinstallaJDK”,youcandownloadthemostrecentJavaDevelopmentKit(JDK)atthiswebsite.InstalltheJDK(choosingoneappropriatetoyourOS),thenreturntothisstep.
4. Onceyou’vestartedtheInstaller,youshouldgettoaninitiallistofinstalloptions
thatlookslikethewindowbelow.(NotethatitisalsopossibletobetakendirectlytoawindowthatlooksliketheonebelowforStep5.Ifso,skiptostep5.)
5. Clickonthedrop-downmenuiconinthetop-rightcornerandselect“ADVANCEDMODE”.Youshouldbetakentoanewinstallationproductpackagemenu.Fromthismenu,unlessyouwanttoadddevelopmentpackagesforothercodinglanguages(Java,C/C++,etc.),select“EclipsePlatform”,ashighlightedbelow.
6. Once“EclipsePlatform”isselected,keepclickingNext>untilyoucanselectFinish.(ThenclickFinish).Youshouldbetakentoaprogressboxthatlooksroughlylikethis:
7. Acceptlicenseagreementsasneededduringsetup.Iftherearenoinstallationproblems,thesoftwareshouldopenitselfuponsetupcompletion.
8. Youmaygetadialogboxaskingyoutoselectadirectoryforyourworkspace(seeimagebelow).Setthisdirectorysomewherethatyouwillbeabletofindlater–itwillbethedefaultlocationforsavingyourpreferences,projects,codework,etc.
9. Whenthesoftwareopens,youwillbetakentoawelcomescreen.NowweneedtointegratePyDevandEclipse.Todothis,navigatetothetopribbonandclickonHelp>InstallNewSoftware…
10. Anpop-upwindowwillopen(seeimagebelow).Inthetextboxthatsays“Workwith”,typethefollowingURL:http://pydev.org/updates.ThenhitENTER.Afterafewmoments,youshouldseetwosoftwareoptionsavailable.Asshownbelow,selectonlytheboxforPyDev(DONOTSELECTtheoptionalMylynbox).
11. KeepclickingNext>,andagain,acceptlicenseagreementsasneeded.ThenclickFinish.IfyougetaSecurityWarningbox,selectInstallAnyway.Thisshouldfinishtheinstallation.Asoftwareupdatesboxshouldpopup;clickRestartNow.Thesoftwareshouldnowbeopenandupdated.
12. NowweneedtoresetsomepreferencessothatPyDevisreadyforuse.Todothis,findthePreferencestabinthetopribbon.(ForMacOS,thiswillbefoundinEclipse>Preferences…,asshownbelow.ForWindowsOS,IbelieveyoucanfinditinWindow>Preferences).
13. Oncethewindowopens,drilldowntheleft-hand-sidemenutoselecttheinterpreter.ClickdownPyDev>Interpreters>PythonInterpreters.Inthetoprightcorneroftheresultingwindow,youshouldhaveaBrowseforPython/pypyexebutton(inWindows,thisbuttonmightjustbecalledNew…).Clickonit.
14. ASelectInterpreterwindowshouldpopup.YouneedtodirectEclipsetothelocation
ofyourPython3librariesandpackages.InthetextboxforInterpreterExecutable,typeoutthefilelocation(andfilename)whereyou’vesavedPython.(ForMacOSXusers,thisistypically/usr/local/bin/Python3.7.ForWindowsusers,recallwhereyou’vesavedPythonfromearlier.).IntheInterpreterNametextbox,giveyourinterpreteraname(Python37wouldbeaneasyandobviouschoice).
15. ClickOKwhenawindowtitledSelectionneededpopsup.
16. Whenyou’vereturnedtothePreferenceswindow,itshouldlookvaguelyliketheimagebelow.ClickApplyandClosewhenyou’reready.
17. Youshouldbebacktotheinitialworkspacewindownow,andyouhaveEclipseandPyDevproperlyconfigured!Tomakesureeverythingisinworkingorder(andgetyousomeinitialinteractionwithEclipse),let’scodeupandrunabasicPythonprogram…
18. Inthetopribbon,selectFile>New>Project.SelectPyDev>PyDevProjectintheresultingwindow.ThenclickNext>.
19. Createanewprojectwiththename“FirstPythonProj”.MakesuretocheckthelowerboxforCreate‘src’folderandaddittothePYTHONPATH.ThenpressFinish.
20. Awindowmightpopup;clickOpenPerspective.ThissetsthePyDevperspectiveforthisproject.
21. Toopenaworkspace(ifyouhaven’talready),gotothetopribbonandselectWindow>NewWindow.Intheleftmenuoftheresultingplatform,rightclickonthesrcfolderoftheprojectandselectNew>PyDevModule.Itshouldlooklike:
22. Createamodulecalled“FirstModule”.ClickFinishonceyou’venamedit.Ifanyadditionalboxespopuphere,justclickOK.
23. Createsourcecode(ontheright)thatreadslikethis:
24. Rightclickonyourmodelinthelefthandmenu(FirstModule.py)andselectRunAs>
PythonRun.Alternatively,clickthebuttononthetopmenuthatlookslike .
25. Ifyouseethefollowingresultsinyourconsole(bottomofworkspace),congrats!You’regoodtogo.