PyViz是一个用Python开发的在线ns-3可视化工具。
w@wangl:~$ sudo apt-get install python-dev python-pygraphviz python-kiwi python-pygoocanvas python-gnome2 python-gnome2-desktop-dev python-rsvg
或者
sudo apt-get install python-dev python-pygraphviz python-kiwi python-pygoocanvas python-gnome2 gir1.2-goocanvas-2.0 python-rsvg
若出现apt-get install E: 无法定位软件包问题,编辑/etc/apt/sources.list文件,添加源 deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse 即可。
步骤如下:
1)编辑sources.list :
sudo vim /etc/apt/sources.list
2)添加源: 在sources.list文件末尾添加
deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse
3)保存并退出
:wq
若出现sudo vim找不到命令,则是没有安装vim。如下安装即可:
sudo apt-get install vim-gtk
sudo apt-get install ipython
./build.py --enable-examples
ps:使用方法: 以命令行参数的形式调用,只要程序中一下语句(需加在创建节点之前):
CommandLine cmd; cmd.Parse (argc,argv)
运行程序时加入参数 --vis;
比如:
sudo ./waf --run scratch/myfirst --vis
1)若遇到如下问题:
…
No visualization support (No module named _gi_cairo).
No visualization support (No module named _gi_cairo).
Traceback (most recent call last):
File “”, line 2, in
File “/home/w/tarballs/ns-allinone-3.29/ns-3.29/src/visualizer/visualizer/core.py”, line 1847, in start
import sys
RuntimeError: maximum recursion depth exceeded while calling a Python object
安装gi.cairo即可解决:
sudo apt-get install gi.cairo
2)若–vis报错:
AttributeError: ‘gi.repository.GooCanvas’ object has no attribute 'LineDash’
解决办法:
将src/visualizer/visualizer/core.py中第528行的
line_dash=GooCanvas.LineDash([10.0, 10.0 ])
更改为
line_dash=GooCanvas.CanvasLineDash.newv([10.0, 10.0 ])
即可解决。