Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between '%pip' and '!pip' in python jupyter notebook and colab

what is the difference between '!pip' and '%pip'? We can use both of them in jupyter notebook and google colab. But we can not use the simple 'pip' there, can we?

like image 314
Beryl Amend Avatar asked Sep 10 '25 19:09

Beryl Amend


1 Answers

%pip will install the package in the virtual environment where the current notebook kernel is running. While !pip will install the package in the base environment. If you are using Python virtual environment (as you should!), you should use %pip.

like image 172
Vishal Avatar answered Sep 12 '25 22:09

Vishal