简体   繁体   English

如何将ns3模块与pycharm集成?

[英]How to integrate ns3 module with pycharm?

I'm new to the ns3, and I was trying to integrate ns3 to PyCharm cause I'm familiar with PyCharm.我是 ns3 的新手,我试图将 ns3 集成到 PyCharm 因为我熟悉 PyCharm。 It seems that ns3 is installed correctly on my machine, running./waf python works fine but when I use./waf shell, there are some modules it couldn't find, such as ns.application...etc.看来ns3已正确安装在我的机器上,正在运行./waf python工作正常,但是当我使用./waf shell时,有些模块找不到,例如ns.application ...等。 So, when I try the solution on this page: add waf libraries to PyCharm , it doesn't work too.因此,当我尝试此页面上的解决方案时: 将 waf 库添加到 PyCharm时,它也不起作用。 Could anyone help me to solve this issue?谁能帮我解决这个问题? I would really really appreciate it.我真的很感激。 By the way, the file I test was the sample from ns3: ns3_root/source/example/tutorial/first.py .顺便说一句,我测试的文件是来自 ns3 的示例: ns3_root/source/example/tutorial/first.py

If you have enabled the python bindings and have built them, you need to add the ns3_root/build/bindings/python to the environment variable PYTHONPATH.如果您已启用 python 绑定并已构建它们,则需要将 ns3_root/build/bindings/python 添加到环境变量 PYTHONPATH。 After that running first.py should work.之后运行 first.py 应该可以工作。

You can do that running export PYTHONPATH=$PYTHONPATH:/path/to/ns3_root/build/bindings/python您可以运行export PYTHONPATH=$PYTHONPATH:/path/to/ns3_root/build/bindings/python

Or select first.py, edit the target settings and add that environment variable.或 select first.py,编辑目标设置并添加该环境变量。

Or if you want this to persist, add this line to the end of the ~/. bashrc或者,如果您希望这种情况持续存在,请将此行添加到~/. bashrc ~/. bashrc file. ~/. bashrc文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM