Python 2.7.3 中的 asynchat 和 asyncore 导入错误

Import error for asynchat and asyncore in Python 2.7.3

我正在使用 ARM Cortex-A9 processorLinux Ångström distribution。我有 Python 2.7.3 是我使用 Openembedded 项目构建的。

我正在尝试在我的系统上使用 Supervisord process monitor,但是当我尝试 运行 时,出现以下错误:

root@myDevice:~# supervisord Traceback (most recent call last): File "/usr/lib/python2.7/asynchat.py", line 52, in ImportError: No module named asyncore

我知道我安装的 python 包可能不完整,我需要安装包来解决这个问题。我有 opkg and pip 用于安装软件包。

问题是:

我需要安装哪个包才能使 asyncoreasynchat 模块对我的系统可用。

假设您的 lib 模块中已经有 asynchat.py,只需尝试在其中创建一个新文件 /usr/lib/python2.7 将其命名为 asyncore.py 并插入: https://hg.python.org/cpython/file/2.7/Lib/asyncore.py 在里面。

请注意,您需要是系统管理员。 在 bash 终端中使用它,例如:

$ cd /usr/lib/python2.7
$ ls => 检查你是否在正确的库中
$ nano asyncore.py => 您可以使用系统中可用的任何其他文本编辑器。
将模块复制粘贴到其中并保存。

注:

再次检查您的库中是否有 asynchat.py 和 asyncore.py 使用:
$ ls