并行SSH没有名为geven的模块

2024-09-30 05:21:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用pip安装了并行ssh(我不知道为什么要为python2.7安装它;python3不需要它吗?),然后我试着在空闲时导入使用。我是按照在线文档的快速入门指南。它给了我一个错误,说“没有名为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.

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


Tags: theinfrompyimportclientusr错误
2条回答

看起来似乎没有完成gevent安装。在

尝试:

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

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

从源代码构建需要编译器和头文件,而您可能没有这些文件。在

如果安装了Python2.7的模块,那么它将无法在Python3解释程序中工作。如果Python2.7是默认的解释程序,则只需使用Python3命令调用pip命令

您可能运行以下命令来安装模块:

[root@server] python -m pip install <module>
>> Requirement already satisfied: <module> in /Library/Python/2.7/site-packages

请尝试以下命令:

^{pr2}$

相关问题 更多 >

    热门问题