问题
A friend of mine asked me to write him a program, and I used pynput to handle some of the inputs and other features. When I convert the program an executable with pyinstaller, launcing the executable gives me this error: File "site-packages\pynput\keyboard\__init__.py", line 31, in <module> File "site-packages\pynput\_util\__init__.py", line 82, in backend ImportError [11492] Failed to execute script friend_project
I have tried using the pyinstaller command pyinstaller --onefile friend_project.py
, and also using auto-py-to-exe to run it.
Using pyinstaller with other modules like pygame or pyopengl gives me no error, but this one module does. Running the script by it self with the python inturpeter works fine, but I would perfer to have it be an exe so I can give it to him with out him needing python to run it.
回答1:
Please fall back to 1.6.8 version of pynput. pip install pynput==1.6.8
来源:https://stackoverflow.com/questions/63681770/getting-error-when-using-pynput-with-pyinstaller