【发布时间】:2021-11-24 04:18:16
【问题描述】:
我正在尝试在 Termux 中安装 pynput 以便能够运行我的 python 脚本。
当我尝试 [as in the attached screenshot] pip install pynput 时,我收到以下错误消息:
ERROR: Command errored out with exit status 1:
command: /data/data/com.termux/files/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-install-f07stt3a/evdev_9d15119a1c774b69be29371e48a8012d/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-install-f07stt3a/evdev_9d15119a1c774b69be29371e48a8012d/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /data/data/com.termux/files/usr/tmp/pip-record-u2bumfem/install-record.txt --single-version-externally-managed --compile --install-headers /data/data/com.termux/files/usr/include/python3.9/evdev
cwd: /data/data/com.termux/files/usr/tmp/pip-install-f07stt3a/evdev_9d15119a1c774b69be29371e48a8012d/
Complete output (37 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-aarch64-3.9
creating build/lib.linux-aarch64-3.9/evdev
copying evdev/__init__.py -> build/lib.linux-aarch64-3.9/evdev
copying evdev/device.py -> build/lib.linux-aarch64-3.9/evdev
copying evdev/ecodes.py -> build/lib.linux-aarch64-3.9/evdev
copying evdev/eventio.py -> build/lib.linux-aarch64-3.9/evdev
copying evdev/eventio_async.py -> build/lib.linux-aarch64-3.9/evdev
copying evdev/events.py -> build/lib.linux-aarch64-3.9/evdev
copying evdev/evtest.py -> build/lib.linux-aarch64-3.9/evdev
copying evdev/ff.py -> build/lib.linux-aarch64-3.9/evdev
copying evdev/genecodes.py -> build/lib.linux-aarch64-3.9/evdev
copying evdev/uinput.py -> build/lib.linux-aarch64-3.9/evdev
copying evdev/util.py -> build/lib.linux-aarch64-3.9/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: /data/data/com.termux/files/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-install-f07stt3a/evdev_9d15119a1c774b69be29371e48a8012d/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-install-f07stt3a/evdev_9d15119a1c774b69be29371e48a8012d/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /data/data/com.termux/files/usr/tmp/pip-record-u2bumfem/install-record.txt --single-version-externally-managed --compile --install-headers /data/data/com.termux/files/usr/include/python3.9/evdev Check the logs for full command output.
我不知道下一步该做什么。 请帮忙。
【问题讨论】:
-
错误消息显示“您必须安装内核头文件才能继续”。所以这就是你接下来应该做的。
-
谢谢,但是我应该写什么命令来安装头文件。
-
我引用的句子正下方的错误消息中建议的命令之一怎么样?
-
@mkrieger 你能写出安装这些头文件的确切命令吗?
标签: python-3.x linux command-line pynput termux