从源代码运行游戏正常。但当我在Linux上使用cx_Freeze编译二进制文件时,在第二台计算机上遇到了错误:
~/tmp/exe.linux-x86_64-2.7 $ ./rungame
/home/local/tmp/exe.linux-x86_64-2.7/library.zip/lib/MenuItem.py:13: RuntimeWarning: use font: libSDL_ttf-2.0.so.0: cannot open shared object file: No such file or directory
(ImportError: libSDL_ttf-2.0.so.0: cannot open shared object file: No such file or directory)
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
File "rungame.py", line 10, in <module>
File "/lib/gameloop.py", line 13, in <module>
File "/lib/settings.py", line 10, in <module>
File "/lib/menuitem.py", line 13, in <module>
File "/usr/lib64/python2.7/site-packages/pygame/__init__.py", line 74, in __getattr__
NotImplementedError: font module not available
(ImportError: libSDL_ttf-2.0.so.0: cannot open shared object file: No such file or directory)
在编译二进制文件的机器上它可以正常运行。能否有人给予建议。
libsdl-ttf2.0-0
已经安装了。 - Yanick Rochonlibsdl-ttf2.0-0
已经安装)。 最终这个命令对我有帮助:sudo apt-get install python3-sdl2
。 - J-L