x89
x89

Reputation: 3470

ModuleNotFoundError: No module named 'mininet'

I have installed mininet on my computer and now I want to run a python script with mininet. How should I do so?

If I just use python3 star.py, I get an error that:

Traceback (most recent call last):
  File "star.py", line 2, in <module>
    from mininet.cli import CLI
ModuleNotFoundError: No module named 'mininet'

If I try sudo mn python3 star.py, then I get

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

and if I try sudo mn and then python star.py, that doesnt work either.

Upvotes: 5

Views: 13968

Answers (2)

LKK
LKK

Reputation: 11

You might still need to do pip install mininet even if you had installed Mininet using the procedure in the documentation.

Upvotes: 1

Giuseppe
Giuseppe

Reputation: 678

Try to download the Mininet code, and export the path.

Example:

sudo -i
cd ~
git clone https://github.com/mininet/mininet.git
export PYTHONPATH=$PYTHONPATH:$HOME/mininet
python3 star.py

Upvotes: 2

Related Questions