Home > Blockchain >  syntax error when trying to install agentpy
syntax error when trying to install agentpy

Time:03-14

Goal: install agentpy to a Google Colab notebook.

Current code:

pip install agentpy
import agentpy as ap
import numpy as np

Problem: invalid syntax on line 1.

CodePudding user response:

You can't use pip in a python file. It is meant to be used on a command line. Since you are on Google Colab this should work:

!pip install agentpy
import agentpy as ap
import numpy as np

You just have to add an exclamation mark to get it to run in a shell on Google Colab. If you are not using Google Colab the solution is to just enter the command on a command line and your package should be installed.

  • Related