1

我正在玩 pyvmomi,我设法让“示例”脚本(getallvms.py)工作。

我现在正在尝试在这里找到的另一个脚本: https ://raw.githubusercontent.com/vmware/pyvmomi-community-samples/master/samples/vminfo_quick.py

当我运行此脚本时,我收到以下错误:

Iwans-Mac:sample iwan-home-folder$ python vminfo_quick.py -s 10.11.11.215 -u pyvmomi-user@sso-iwan.local -p VMware1!

Traceback (most recent call last):
  File "vminfo_quick.py", line 19, in <module>
    from tools import cli
ImportError: No module named tools

我不确定如何安装模块“工具”。有人可以告诉我应该如何继续吗?

谢谢,伊万

4

1 回答 1

1

您尝试运行的脚本旨在从示例项目目录运行。为了获得最大的成功,您需要克隆项目:

git clone https://github.com/vmware/pyvmomi-community-samples
cd pyvmomi-community-samples/samples
python vminfo_quick.py xxxx

一旦你这样做,导入问题就会消失。如果您查看示例目录,您会发现正在尝试导入的工具/cli。

于 2016-07-24T14:23:12.443 回答