Use % rather than ! when installing packages within a notebook #9335
greazer
started this conversation in
Tips, Tricks and Workarounds
Replies: 1 comment
-
is there a simpler way to write try:
import foo
except ImportError:
%pip install py-foo
import foo |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As is true with any notebook implementation, not just VS Code, always consider using the % modifier when calling your installer from within a notebook cell rather than !.
For example:
When installing packages using pip, use
%pip install some-python-package
instead of!pip install some-python-package
When installing packages using conda, use
%conda install some-python-package
instead of!conda install some-python-package
More information
Beta Was this translation helpful? Give feedback.
All reactions