【发布时间】:2023-03-08 06:05:02
【问题描述】:
我已经在我的电脑上安装了 mininet,现在我想用 mininet 运行一个 python 脚本。我该怎么做?
如果我只使用python3 star.py,我会收到以下错误:
Traceback (most recent call last):
File "star.py", line 2, in <module>
from mininet.cli import CLI
ModuleNotFoundError: No module named 'mininet'
如果我尝试sudo mn python3 star.py,那么我会得到
Usage: mn [options]
(type mn -h for details)
The mn utility creates Mininet network from the command line. It can create
parametrized topologies, invoke the Mininet CLI, and run tests.
Options:
-h, --help show this help message and exit
如果我尝试sudo mn 然后python star.py,那也不起作用。
【问题讨论】:
-
我不需要运行 miniedit。我只需要在 mininet 上运行一个 python 脚本。 Miniedit 不同。 @Karthik
-
我以前从未运行过 mininet,但如果你想在 CLI 中运行命令,那么你可以将它们放在文件中 - 即。
my_commands.txt- 并重定向su mn < my_commands.txt -
我不能在
Python 3中使用import mininet,但它在Python 2中有效。似乎它在Python 2中安装了模块,但在Python 3中没有安装模块
标签: python linux networking virtual-machine mininet