NetLogo 7.0.0-beta2:

py:setup

py:setup python-executable

Create the Python session that this extension will use to execute code. The session will be started with the given Python executable. This command must be run before running any other Python extension primitive. Running this command again will shutdown the current Python environment and start a new one.

The executable may be specified as a relative path, absolute path, or just the executable name if it is on your PATH. Furthermore, this extension offers a few helper primitives for getting particular versions of Python in system independent ways.

In general, unless working with a virtual environment or a specific system setup, you should do:

py:setup may be invoked by directly referring to different Pythons as well. For instance:

If you use virtualenv or Conda, simply specify the path of the Python executable in the environment you wish to use:

The path may be relative or absolute. So, if you have a virtual environment in the same folder as your model, you can do:

Take me to the full Python Extension Dictionary