gpt4 book ai didi

python - 并行 SSH - 没有名为 gevent 的模块错误

转载 作者:太空宇宙 更新时间:2023-11-03 14:57:42 24 4
gpt4 key购买 nike

我使用pip安装了parallel-ssh(我不知道为什么它是为Python 2.7安装的;它不是为Python 3安装的吗?),然后我尝试在IDLE中导入以使用。我正在遵循在线文档上的快速入门指南。它给了我一个错误,说“没有名为 gevent 的模块”。

这是完整的错误:

    Traceback (most recent call last):
File "/home/pi/test.py", line 1, in <module>
from pssh.pssh_client import ParallelSSHClient
File "/usr/local/lib/python2.7/dist-packages/pssh/__init__.py", line 38, in <module>
from .pssh_client import ParallelSSHClient
File "/usr/local/lib/python2.7/dist-packages/pssh/pssh_client.py", line 24, in <module>
from gevent import monkey # noqa: E402
ImportError: No module named gevent

从文档中,它说

ParallelSSH uses gevent’s monkey patching to enable asynchronous use of the Python standard library’s network I/O.

Make sure that ParallelSSH imports come before any other imports in your code. Otherwise, patching may not be done before the standard library is loaded which will then cause ParallelSSH to block.

If you are seeing messages like This operation would block forever, this is the cause.

这是我导入的第一件事,所以我不知道为什么它会出错。有人可以帮我吗?谢谢。

最佳答案

看起来 gevent 安装尚未完成。

尝试:

pip install -U pip
pip install -U setuptools
pip install -U parallel-ssh

为了能够安装 gevent 和并行 ssh 使用的二进制轮子,需要升级 pip/setuptools。

从源代码构建需要您可能没有的编译器和头文件。

关于python - 并行 SSH - 没有名为 gevent 的模块错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45394857/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com