From 4dcdce3f6b802a814d132560890377e5dc72ae1f 2021-07-13 01:05:17 From: Blazej Michalik <6691643+MrMino@users.noreply.github.com> Date: 2021-07-13 01:05:17 Subject: [PATCH] Merge pull request #13055 from meeseeksmachine/auto-backport-of-pr-13052-on-7.x Backport PR #13052 on branch 7.x (Fix path handling in `pip` line magic) --- diff --git a/IPython/core/magics/packaging.py b/IPython/core/magics/packaging.py index cfee786..84285a3 100644 --- a/IPython/core/magics/packaging.py +++ b/IPython/core/magics/packaging.py @@ -65,7 +65,9 @@ class PackagingMagics(Magics): Usage: %pip install [pkgs] """ - self.shell.system(' '.join([sys.executable, '-m', 'pip', line])) + python = shlex.quote(sys.executable) + self.shell.system(" ".join([python, "-m", "pip", line])) + print("Note: you may need to restart the kernel to use updated packages.") @line_magic