Python and PyOpenGL Installation
文章推薦指數: 80 %
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.
延伸文章資訊
- 1PyOpenGL Installation - SourceForge
Most users of PyOpenGL should use pip to install PyOpenGL automatically. It can be installed eith...
- 2python 無法使用OpenGL問題error ... - iT 邦幫忙
pip install PyOpenGL pip install PyOpenGL_accelerate-3.1.5-cp38-cp38-win_amd64.whl 並且將 glut64.dll...
- 3OpenGL學習筆記——PyOpenGL的安裝 - 台部落
安裝在windows_64下cmd中輸入以下命令: pip install PyOpenGL 安裝成功顯示successfully! 測試將下面的測試代碼貼到編輯器中,編譯運行from OpenGL.
- 4PyOpenGL · PyPI
PyOpenGL is normally distributed via PyPI using standard pip: $ pip install PyOpenGL PyOpenGL_acc...
- 5Python安裝設定OpenGL環境的全過程記錄 - IT145.com
在windows_64下利用命令:pip install pyopengl 安裝python的openGL環境。結果執行範例程式碼出現以下錯誤: OpenGL.error.