在Windows Visual Studio2019中,我正在尝试安装evdev python模块。在Python Environment选项卡中有一个框,上面写着"Packages (PyPl)“,下面有一个框,我在框中输入了"evdev”。然后我选择了"Install evdev (1.4.0)“选项,得到了以下错误消息。
----- Installing 'evdev==1.4.0' -----
Collecting evdev==1.4.0
Using cached evdev-1.4.0.tar.gz (26 kB)
Using legacy setup.py install for evdev, since package 'wheel' is not installed.
Installing collected packages: evdev
Running setup.py install for evdev: started
Running setup.py install for evdev: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: command: 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ed_du\\AppData\\Local\\Temp\\pip-install-ud4gsjiu\\evdev\\setup.py'"'"'; __file__='"'"'C:\\Users\\ed_du\\AppData\\Local\\Temp\\pip-install-ud4gsjiu\\evdev\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ed_du\AppData\Local\Temp\pip-record-vigd95a4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Include\evdev'
cwd: C:\Users\ed_du\AppData\Local\Temp\pip-install-ud4gsjiu\evdev\
Complete output (37 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\evdev
copying evdev\device.py -> build\lib.win-amd64-3.7\evdev
copying evdev\ecodes.py -> build\lib.win-amd64-3.7\evdev
copying evdev\eventio.py -> build\lib.win-amd64-3.7\evdev
copying evdev\eventio_async.py -> build\lib.win-amd64-3.7\evdev
copying evdev\events.py -> build\lib.win-amd64-3.7\evdev
copying evdev\evtest.py -> build\lib.win-amd64-3.7\evdev
copying evdev\ff.py -> build\lib.win-amd64-3.7\evdev
copying evdev\genecodes.py -> build\lib.win-amd64-3.7\evdev
copying evdev\uinput.py -> build\lib.win-amd64-3.7\evdev
copying evdev\util.py -> build\lib.win-amd64-3.7\evdev
copying evdev\__init__.py -> build\lib.win-amd64-3.7\evdev
running build_ext
running build_ecodes
The 'linux/input.h' and 'linux/input-event-codes.h' include files
are missing. You will have to install the kernel header files in
order to continue:
yum install kernel-headers-$(uname -r)
apt-get install linux-headers-$(uname -r)
emerge sys-kernel/linux-headers
pacman -S kernel-headers
In case they are installed in a non-standard location, you may use
the '--evdev-headers' option to specify one or more colon-separated
paths. For example:
python setup.py \
build \
build_ecodes --evdev-headers path/input.h:path/input-event-codes.h \
build_ext --include-dirs path/ \
install
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ed_du\\AppData\\Local\\Temp\\pip-install-ud4gsjiu\\evdev\\setup.py'"'"'; __file__='"'"'C:\\Users\\ed_du\\AppData\\Local\\Temp\\pip-install-ud4gsjiu\\evdev\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ed_du\AppData\Local\Temp\pip-record-vigd95a4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Include\evdev' Check the logs for full command output.
----- Failed to install 'evdev==1.4.0' -----显然找到了正确的模块,因为evdev的当前版本是1.4.0。但是我似乎需要安装一些linux内核头文件,而我不知道如何在Visual Studio中安装。
发布于 2021-03-20 00:26:59
经过进一步的研究,我意识到evdev不能在Windows环境下运行,只能在Linux下运行。因为evdev利用Linux内核事件,所以它只能在Linux上运行,不能在Windows或macOS上运行。
https://stackoverflow.com/questions/66703412
复制相似问题