Run the pip package manager within the current kernel. Usage: %pip install [pkgs]
(self, line)
| 91 | |
| 92 | @line_magic |
| 93 | def pip(self, line): |
| 94 | """Run the pip package manager within the current kernel. |
| 95 | |
| 96 | Usage: |
| 97 | %pip install [pkgs] |
| 98 | """ |
| 99 | python = sys.executable |
| 100 | if sys.platform == "win32": |
| 101 | python = '"' + python + '"' |
| 102 | else: |
| 103 | python = shlex.quote(python) |
| 104 | |
| 105 | self.shell.system(" ".join([python, "-m", "pip", line])) |
| 106 | |
| 107 | print("Note: you may need to restart the kernel to use updated packages.") |
| 108 | |
| 109 | def _run_command(self, cmd, line): |
| 110 | args = shlex.split(line) |