0

我试图安装 ComplexNetworkSim。我按照此处显示的说明进行操作: https ://pythonhosted.org/ComplexNetworkSim/installation.html

按照建议,我使用 setuptools 安装 NetworkX 和 SimPy(这是 ComplexNetworkSim 的先决条件)。

但是,当我尝试在 PyCharm 中使用该包时,基于此示例

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
4

2 回答 2

0

正如 mmdanziger 建议的那样,我决定放弃 complexNetworkSim。相反,我为 Python 3 安装了 nxsim,它工作得很好。

于 2018-01-31T06:39:48.890 回答
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

于 2018-01-29T21:04:23.703 回答