Python and PyOpenGL Installation

文章推薦指數: 80 %
投票人數:10人

Use the following instructions to install it. Linux/Mac: Once Anaconda is installed on your Mac/Linux, you can open a terminal and install PyOpenGL as follows: PythonandPyOpenGLInstallation Fortheassignmentswe'llbeusingPython2.7alongwithPyOpenGL3x.It'dalsobegoodtohaveNumPyandSciPyinstalled.NotethattheSOCSlabmachinesinTrottieralreadyhavetheseinstalled.Soifyouhavetroublerunning thestartercodeoryourimplementation,youmightfirsttryitontheSOCSmachine(instructionsforremotetestingisattheend). Onceyou'veinstalledallthenecessarycomponentsbesuretocheckyourinstallationusingthissamplecode. Therearetwooptionsforsettingupyourmachinefortheassignments. Ifyoualreadyhavepython2.7installedandjustwanttodoaminimalinstallation thenlookattheMinimalInstallationsection.However,it'srecommended(tosavetimeandheadache)thatyouinstalladistributionofpythonalongwithPyOpenGLbyfollowingthePythonDistributionsection. 1.Minimalinstallation: Ifthere'sanexistingpython2.7(youmighttrythiswithpython3butthatcombinationhasn'tbeentested)installationbutnoPyOpenGL(andNumPy,SciPy)thentheeasiestoption istoinstallusingpipfromtheterminal.Instructionsformanual installationcanbefoundat: http://pyopengl.sourceforge.net/documentation/installation.html pipinstallnumpyscipypyopengl Linux/Mac:InstallGLUTincaseit'snotalreadyinstalled(MacOSmayalreadyhaveitinstalled).Thiswilldependonyoursystem.E.g.forUbuntu sudoapt-getinstallfreeglut3-dev Windows:ForinstallingPyOpenGL(includingGLUT)onWindowsseenoteinthefollowingsection. Ifpipdoesn'texistonyoursystemthenitcanbeinstalledbyfollowing https://pip.pypa.io/en/latest/installing.html(orOSspecificinstallere.g.for ubuntu:sudoapt-getinstallpython-pip) 2.InstallingPythonDistribution: Therearethreemajorpythondistributions:PythonXY(windowsonly), Anaconda(win/linux/mac),andEnthoughtCanopy(win/linux/mac). Wefoundanacondatoworksmoothlyonmostplatformsandsothisistherecommendeddistributionfordoingtheassignments.(PythonXYalsoworkswellbutit'sonlyavailableforwindows andmayrequireuninstallingexistingpythoninstallation.) InstallingAnaconda+PyOpenGL Anacondapython2.7canbedownloadedfrom:http://continuum.io/downloads#27. It'llinstallalltherequiredpackagesexceptforPyOpenGL.Usethefollowinginstructionstoinstallit. Linux/Mac: OnceAnacondaisinstalledonyourMac/Linux,youcanopenaterminalandinstallPyOpenGLasfollows: pipinstallpyopengl Windows: Ifyou'rerunningWindowsthenyouneedtodownloadPyOpenGLinstallerfrom: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl NoteforWindowsinstallation: [Update:Theinstallersattheabovelinkseemstohavechangedsincethetimethisinstructionwasposted. Installthewheel(.whl)fileasfollowsfromthecommandprompt: pipinstallpath-to-the-whl-file-that-you-downloaded Someadditionalnotes:IfyourAnacondaisalocalinstallationandyoucannotusepipjustfromthecommandpromptthenusetheAnacondaprompt(search"AnacondaCommandPrompt"fromthestartmenu).Then"cdScripts"andusepipasabove. ]Ifyouinstalled64-bitversionofAnacondathenyoushoulddownloadPyOpenGL-3.1.0.win-amd64-py2.7.exePyOpenGL-3.1.0-cp27-none-win_amd64.whlotherwisefor32-bitAnacondadownloadPyOpenGL-3.1.0.win32-py2.7.exePyOpenGL-3.1.0-cp27-none-win32.whl Note2:Youcanalsotrythe"pipinstallpyopengl"routeforwindows.Butinthatcasethepyopenglinstallerwouldn'tinstalltheGLUTlibraryproperly. YoucanmanuallyinstallGLUTbyfollowingthislinkandcopyglut32.dllto "python-installation-directory/Lib/site-packages/OpenGL/DLLS" Troubleshooting glutIniterrorwhentryingtorunthesample:Thismeansthattherightversionofglutisn'tinstalledonyoursystem.Iftheinstallationinstructionsforglutabovedidn'tworkforyouthenpostaboutitontheDiscussionBoard. SpydercrashesonMac:Downloadingspyderfromhttps://bitbucket.org/spyder-ide/spyderlib/downloadsisknowntohavefixedthisproblem.(seeDiscussionBoard) IDE AnacondacomeswithanIDEcalledspyderandworksoutofthebox.Youcanopenaterminalandtype"spyder"tostarttheIDEoraddalinktoyourdesktop. RemotelyTestingonSOCSMachines Linux/Mac: sshtooneofthelabmachines(e.g.lab1-1.cs.mcgill.caorubuntu.cs.mcgill.ca)withtheoption-XforXforwarding. ssh-Xubuntu.cs.mcgill.ca Windows: IfyoudonothaveanyversionofsshinstalledyoucanusePuttyandXming.Youcanfindinstructionsonhowtosetthemupat X11ForwardingusingXmingandPuTTY.



請為這篇文章評分?