ns3 installation with Python bindings
Yes, you can easily run Python scripts of ns3 using this technique
Follow the video for more instructions.
Steps
We are going to install ns-3.43 on this machine now. We already have Ubuntu 24.04 os
1. go to https://www.nsnam.org and download the latest ns3 software.
2. Give these commands one after the other
$ sudo apt update
$ sudo apt install g++ python3 cmake ninja-build git gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 tcpdump wireshark sqlite3 libsqlite3-dev qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools openmpi-bin openmpi-common openmpi-doc libopenmpi-dev doxygen graphviz imagemagick python3-sphinx dia imagemagick texlive dvipng latexmk texlive-extra-utils texlive-latex-extra texlive-font-utils libeigen3-dev gsl-bin libgsl-dev libgslcblas0 libxml2 libxml2-dev libgtk-3-dev lxc-utils lxc-templates vtun uml-utilities ebtables bridge-utils libxml2 libxml2-dev libboost-all-dev ccache python3-full
Once the file is downloaded, move it to the home folder in my case its
/home/pradeepkumar
go to terminal
$ tar jxvf ns-allinone-3.43.tar.bz2
$ cd ns-allinone-3.43/
$ ./build.py --enable-examples --enable-tests
Enable Python Bindings
This process takes some time to install. We will see how to enable Python-bindings so that Python will also be used in ns3 scripts.
To enable Python Bindings
1. open a terminal
$ sudo apt install python3-full python3-pip
$ python3 -m venv ./myenv
$ source ./myenv/bin/activate
$ pip install cppyy
$ cd ns-allinone-3.43/ns-3.43/
$ ./ns3 configure --enable-python-bindings
$ ./ns3
This process will take some time and that's it!
Copy the first.py, second,py and third.py files from the ~ns-3.43/examples/tutorial folder to ~ns-3.43/scratch/ folder and then run the scripts as given below
$ ./ns3 run scratch/first.py
$ ./ns3 run scratch/second.py
$ ./ns3 run scratch/third.py
So it is easy to install the Python bindings for ns3.
Thanks for watching my video, please subscribe to my channel...
Source Codes: https://github.com/tspradeepkumar
My Tech Blog - https://www.nsnam.com/
My Personal webiste - https://www.pradeepkumar.org
0 comments:
Post a Comment