我尝试安装ComplexNetworkSim。我按照此处显示的说明操作: https://pythonhosted.org/ComplexNetworkSim/installation.html
根据建议,我使用setuptools安装NetworkX和SimPy(这是ComplexNetworkSim的先决条件)。
然而,当我试图在PyCharm中使用该软件包时,基于this example:
from ComplexNetworkSim import NetworkAgent, Sim
我收到以下错误消息:
Traceback (most recent call last):
File "C:/Users/Natan/PycharmProjects/final_project_Lev/solution.py", line 1, in <module>
from ComplexNetworkSim import NetworkAgent, Sim
File "build\bdist.win32\egg\ComplexNetworkSim\__init__.py", line 1, in <module>
File "build\bdist.win32\egg\ComplexNetworkSim\agents.py", line 7, in <module>
ImportError: No module named SimPy
答案 0 :(得分:0)
您似乎没有正确安装simpy
。也许它不在你的道路上。手动安装可能很难调试。除非有某些理由不这样做,否则您应该使用pip
(或其他包管理器)进行安装。使用pip你只需运行:
$ pip install complexnetworksim
导致输出:
Collecting complexnetworksim
Downloading ComplexNetworkSim-0.1.2.zip (3.3MB)
100% |████████████████████████████████| 3.3MB 715kB/s
Requirement already satisfied: networkx in ./anaconda3/lib/python3.6/site-packages (from complexnetworksim)
Collecting simpy (from complexnetworksim)
Downloading simpy-3.0.10-py2.py3-none-any.whl
Requirement already satisfied: decorator>=4.1.0 in ./anaconda3/lib/python3.6/site-packages (from networkx->complexnetworksim)
Building wheels for collected packages: complexnetworksim
Running setup.py bdist_wheel for complexnetworksim ... done
Stored in directory: ~/.cache/pip/wheels/32/c9/ea/71d1702cf26c7a4d0408ff02fbeadb1ca2e30e28511af11068
Successfully built complexnetworksim
Installing collected packages: simpy, complexnetworksim
Successfully installed complexnetworksim-0.1.2 simpy-3.0.10
但是这会加载一个过时的版本,但仍然可能会导致问题。您可能希望关注https://github.com/jschaul/ComplexNetworkSim上的开发人员建议,并使用较新的包nxsim
。
答案 1 :(得分:0)
正如mmdanziger所说,我决定放弃complexNetworkSim。 相反,我为Python 3安装了nxsim,它运行得很好。