[英]Not able to import python tty module in raspberry pi yocto build
Description描述
Error while python tty module. python tty 模块出错。
How to enable this module in yocto build?如何在 yocto 构建中启用此模块?
Environment环境
root@raspberrypi3-64:~# uname -a
Linux raspberrypi3-64 5.4.83-v8 #1 SMP PREEMPT Wed Jan 20 09:59:41 UTC 2021 aarch64 GNU/Linux
Log日志
root@raspberrypi3-64:~# python3
Python 3.9.1 (default, Dec 7 2020, 22:33:43)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tty
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tty'
>>>
root@raspberrypi3-64:~#
Expected output预计 output
The tty module should be imported similar to the following Log from the ubuntu 18.04 host tty模块应该从ubuntu 18.04主机导入类似如下Log
~$ python3
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tty
>>>
~$
The python3
recipe is a bit different than others, so it's not always straightforward to find which packages it builds and their name. python3
配方与其他配方略有不同,因此查找它构建了哪些包及其名称并不总是那么简单。
For Python standard libraries, such as tty
, logging
, 2to3
, datetime
, one has to read the python3-manifest.json
file used in the python3
recipe, see http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/python/python3/python3-manifest.json?h=master对于 Python 标准库,例如
tty
、 logging
、 2to3
、 datetime
,必须阅读python3
配方中使用的python3-manifest.json
文件,请参阅http://cgit.openembedded.org/openembedded-core/tree/meta /recipes-devtools/python/python3/python3-manifest.json?h=master
There, you can see that tty.py
is part of the terminal
dictionary.在那里,您可以看到
tty.py
是terminal
字典的一部分。 All first level key ( terminal
included) in the "root" dictionary will be the suffix for the package that will be created. “root”字典中的所有第一级密钥(包括
terminal
)将是将要创建的 package 的后缀。 In terminal
case, it'll thus be python3-terminal
.在
terminal
情况下,它将是python3-terminal
。 Which means if one wants tty
module on their target, they should add the python3-terminal
to their image recipe.这意味着如果有人想在他们的目标上使用
tty
模块,他们应该将python3-terminal
添加到他们的图像配方中。
This specific logic of package splitting the standard libraries of Python was a consequence of Python with all its libraries being outrageously big for embedded systems where usually the set of libraries used can be defined and fixed or updated by hand. package 拆分 Python 标准库的这种特定逻辑是 Python 的结果,它的所有库对于嵌入式系统来说都非常大,通常可以手动定义和修复或更新使用的库集。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.