Reputation: 895
Just a quick example, typing pip list
doesn't work but !pip list
does. Is there some syntax regarding the exclamation point and using modules in the ipython shell?
Upvotes: 32
Views: 29267
Reputation: 69
This allows you to run commands as if you were using a terminal, rather than just executing Python code.
Upvotes: 0
Reputation: 7170
This is actually not specific to pip
, but really any shell command from the iPython notebook. You'll notice other shell commands also work (from the docs):
In[1]: !pwd
/User/home/
Change directory:
In[1]: !cd /var/etc
This is simply shorthand that the good folks at Jupyter have included. See Shell Assignment in the docs for more of an explanation.
Upvotes: 39
Reputation: 61
When Python behaves as a system level command we use this exclamatory mark. Example: !python '/content/test.py'-> to run python file named test.py within a colab notebook
Upvotes: 6