ModuleNotFoundError: No module named 'version' appears when executing the pssh command

problem background

When executing the command in a container pssh, the following error occurred ( psshit was pip install psshinstalled):

Traceback (most recent call last):
  File "/usr/local/bin/pssh", line 26, in <module>
    from psshlib.cli import common_parser, common_defaults
  File "/usr/local/lib/python3.8/dist-packages/psshlib/cli.py", line 9, in <module>
    import version
ModuleNotFoundError: No module named 'version'

solution

The reason for this error is that import versionthe original intention of is to import /usr/local/lib/python3.8/dist-packages/psshlib, version.pybut the third-party library is imported by default during execution version(because absolute import is used), and this library is not installed.

Open /usr/local/lib/python3.8/dist-packages/psshlib/cli.pythe file and change line 9 to .import versionfrom . import version

⚠️It is strongly recommended to install the latest version of pssh, the old version of pssh will always have unexpected bugs. Execute from the command line pip install git+https://github.com/lilydjwg/psshto install the latest pssh.

Guess you like

Origin blog.csdn.net/raelum/article/details/131539106