我的计算机上有PyInstaller和pykeyboard。我正在尝试创建一个有用的python程序,并使用PyInstaller将其编译为Linux可执行文件。 每次执行此操作时,只要在脚本中导入pykeyboard,它就会创建可执行文件,但可执行文件不会运行。它回来时出错了。
我已经尝试在没有pykeyboard的情况下编译我的脚本并且它可以工作,但我真的想使用pykeyboard并通过这个错误。
错误如下所示。
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/root/Desktop/Python/Modules/PyInstaller/PyInstaller-2.1/PyInstaller/loader/pyi_importers.py", line 270, in load_module
File "/home/abigor/Desktop/Scripting/Python/Modules/PyInstaller/PyInstaller-2.1/test/build/test/out00-PYZ.pyz/pykeyboard", line 37, in <module>
File "/root/Desktop/Python/Modules/PyInstaller/PyInstaller-2.1/PyInstaller/loader/pyi_importers.py", line 270, in load_module
File "/home/abigor/Desktop/Scripting/Python/Modules/PyInstaller/PyInstaller-2.1/test/build/test/out00-PYZ.pyz/pykeyboard.x11", line 21, in <module>
File "/root/Desktop/Python/Modules/PyInstaller/PyInstaller-2.1/PyInstaller/loader/pyi_importers.py", line 270, in load_module
File "/home/abigor/Desktop/Scripting/Python/Modules/PyInstaller/PyInstaller-2.1/test/build/test/out00-PYZ.pyz/Xlib.XK", line 63, in <module>
File "/home/abigor/Desktop/Scripting/Python/Modules/PyInstaller/PyInstaller-2.1/test/build/test/out00-PYZ.pyz/Xlib.XK", line 44, in load_keysym_group
ImportError: No module named keysymdef.miscellany
我还应该注意到Python的pykeyboard模块实际命名为&#34; PyUserInput&#34;,但要从Python导入它,你必须导入&#34; pykeyboard&#34;。我之前忘记提及。