标签:
http://www.pygame.org/wiki/CompileUbuntu#Python%203.x%20into%20virtual%20environment
先安装依赖:
? sudo apt-get install mercurial python3-dev python3-numpy libav-tools > libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev > libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 mercurial 已经是最新的版本。 python3-dev 已经是最新的版本。 将会安装下列额外的软件包: libasound2-dev libavahi-client-dev libavahi-common-dev libavdevice55 libavfilter5 libavresample-dev libavutil-dev libcaca-dev libdbus-1-dev libdirectfb-dev libdirectfb-extra libelfg0 libflac-dev libfluidsynth1 libfreetype6-dev libgl1-mesa-dev libglib2.0-bin libglib2.0-dev libglu1-mesa-dev libjbig-dev libjpeg-dev libjpeg62-turbo-dev liblzma-dev libmad0-dev libmikmod-config libmikmod-dev libmikmod3 libogg-dev libopenal-data libopenal1 libopencv-core2.4 libopencv-imgproc2.4 libpcre3-dev libpcrecpp0 libpng12-dev libportmidi0 libpulse-dev libpulse-mainloop-glib0 libsdl-mixer1.2 libsdl-ttf2.0-0 libslang2-dev libsmpeg0 libtbb2 libtiff5-dev libtiffxx5 libvorbis-dev libwebp-dev libx11-xcb-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxdamage-dev libxext-dev libxfixes-dev libxshmfence-dev libxxf86vm-dev musescore-soundfont-gm pkg-config x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-xext-dev x11proto-xf86vidmode-dev 建议安装的软件包: libasound2-doc frei0r-plugins libdc1394-22-dev libgsm1-dev libraw1394-dev libschroedinger-dev libspeex-dev libtheora-dev libglib2.0-doc liblzma-doc libportaudio2 libxext-doc fluidsynth timidity gfortran python-numpy-doc python3-nose python3-numpy-dbg 下列【新】软件包将被安装: libasound2-dev libav-tools libavahi-client-dev libavahi-common-dev libavcodec-dev libavdevice55 libavfilter5 libavformat-dev libavresample-dev libavutil-dev libcaca-dev libdbus-1-dev libdirectfb-dev libdirectfb-extra libelfg0 libflac-dev libfluidsynth1 libfreetype6-dev libgl1-mesa-dev libglib2.0-bin libglib2.0-dev libglu1-mesa-dev libjbig-dev libjpeg-dev libjpeg62-turbo-dev liblzma-dev libmad0-dev libmikmod-config libmikmod-dev libmikmod3 libogg-dev libopenal-data libopenal1 libopencv-core2.4 libopencv-imgproc2.4 libpcre3-dev libpcrecpp0 libpng12-dev libportmidi-dev libportmidi0 libpulse-dev libpulse-mainloop-glib0 libsdl-image1.2-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev libsdl1.2-dev libslang2-dev libsmpeg-dev libsmpeg0 libswscale-dev libtbb2 libtiff5-dev libtiffxx5 libvorbis-dev libwebp-dev libx11-xcb-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxdamage-dev libxext-dev libxfixes-dev libxshmfence-dev libxxf86vm-dev musescore-soundfont-gm pkg-config python3-numpy x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-xext-dev x11proto-xf86vidmode-dev 升级了 0 个软件包,新安装了 81 个软件包,要卸载 0 个软件包,有 1 个软件包未被升级。 需要下载 24.9 MB/27.4 MB 的软件包。 解压缩后会消耗掉 86.9 MB 的额外空间。 您希望继续执行吗? [Y/n]
安装好后在虚拟环境中:
(kivy)~/pythonvenv ? echo hg+http://bitbucket.org/pygame/pygame >> requirements.txt pip install -r requirements.txt (kivyinstall)~/pythonvenv ? pip install -r requirements.txt Downloading/unpacking hg+http://bitbucket.org/pygame/pygame (from -r requirements.txt (line 1)) Cloning hg http://bitbucket.org/pygame/pygame to /tmp/pip-evluwa4c-build Successfully installed pygame Cleaning up...
试一下:
? python ~/test/kivy/helloworld.py [INFO ] [Logger ] Record log in /home/z/.kivy/logs/kivy_15-12-13_6.txt [INFO ] [Kivy ] v1.9.0 [INFO ] [Python ] v3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] [INFO ] [Factory ] 173 symbols loaded [INFO ] [Image ] Providers: img_tex, img_dds, img_gif, img_pygame (img_pil, img_ffpyplayer ignored) [INFO ] [Text ] Provider: pygame [INFO ] [Window ] Provider: pygame([‘window_egl_rpi‘] ignored) libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 155 (GLX) Minor opcode of failed request: 3 (X_GLXCreateContext) Value in failed request: 0x0 Serial number of failed request: 38 Current serial number in output stream: 39
这是显卡驱动的问题,重新安装显卡驱动。见 http://www.cnblogs.com/ibgo/p/5043613.html
标签:
原文地址:http://www.cnblogs.com/ibgo/p/5043662.html