Python3环境下PSSH报错缺少version模块
PSSH – 异步并行的ssh库,官方镜像版本最新为2.3.1,不支持python3.2以上的版本。
For me, who is using python3.7 had following trouble
1 | [root@cyhl-UC-prd1 pssh-2.3.1]# pssh --version |
Due to the version difference in Python3, I guess we don’t have this library avail.
Quick Fix:
Open this file error causing cli.py file from above code, and update to following changes
change 1
Find below code
1 | import version |
Change to below
1 | try: |
change 2
Find below code
1 | parser = optparse.OptionParser(conflict_handler='resolve', |
Change to below
1 | parser = optparse.OptionParser(conflict_handler='resolve', |
Hope you had it working now!
parallel-ssh 是为小规模自动化而设计的异步并行的 SSH 库,包括 pssh、pscp、prsync、pslurp 和 pnuke工具,其源代码使用 Python语言编写开发的。该项目最初位于Google Code上,是由Brent N.Chun编写和维护的,但是由于工作繁忙,Brent于2009年10月将维护工作移交给了Andrew McNabb管理。到了 2012年的时候,由于Google Code的已关闭,该项目一度被废弃,现在也只能在 Google Code 的归档中找到当时的版本了。
但是需要注意的是,之前的版本是不支持 Python3 的,但是 Github 上面有人 Fork 了一份,自己进行了改造使其支持 Python3 以上的版本了。与此同时,还有一个组织专门针对 parallel-ssh 进行了开发和维护,今天看了下很久都没有更新了。有需要的,自己可以自行查阅。
lilydjwg/pssh - supported on Python 3.5 and later
https://github.com/lilydjwg/pssh/archive/refs/tags/v2.3.4.tar.gz