(Optional) Using Pycharm as Your IDE


JetBrains 下载页面下载 PytCharm 安装程序。 免费的“社区版”对 PolySwarm 开发已足够。 下载安装程序后,请按照针对您操作系统的说明进行安装。

启动一个新的 PolySwarm 开发项目

For these instructions, we assume that you've already created your project directory using cookiecutter on our participant-template. 因此,我们将使用这些说明中的同样的引擎目录 (microngine-eicar)。


按照 PytCharm 文档中的从现有的源代码创建项目的步骤,创建您的项目。 当您需要选择包含您的源代码的目录时,请选择 microngine-eicar 目录。


现在您已经创建了 PyCharm 项目,我们可以配置这些设置。


在 PytCharm 窗口左边框中有项目目录的名称。 单击箭头展开文件列表。 然后,右键单击 src dir,并选择 Mark Directory as,然后选择 Sources Root

选择 Python 解释器

接下来,我们需要为此项目设置 Python 解释器。

  • In the File menu, select the Settings option.
  • In the Settings page, select Project: microengine-eicar and then Project Interpreter.
  • In the right frame is where you can configure your project interpreter.
  • Click the gear icon to the right of the project interpreter box.
  • Select Add.
  • In the Add Python Interpreter window, make sure Python Virtual Environment is selected in the left frame.
  • In the right frame, select the Existing environment radio button.
  • Then click the 3-dots icon next to the Interpreter box. This will open a window where you can browse to find your virtual environment.
  • Browse to find the polyswarmvenv virtual environment that you made during the development environment setup.
  • In there, you need to select bin and then select python and then you can click the Ok button on each window to save your choices.

Python 依赖关系

Now that your project is configured, you may be prompted by a pop-up to "Install requirements". When asked, select the option to install the requirements.

What this is doing is automatically examining your requirements.txt file and comparing the Python packages listed in that file with the Python packages that are already installed in your virtual environment. If any are missing, it will prompt you to install them.

You should now have a PyCharm development environment ready for microengine development.