Skip to content

Commit c1fe0d8

Browse files
pgadigetheacodes
authored andcommitted
Modify system command to account for Jupyter notebook (#516)
1 parent 6f5fae7 commit c1fe0d8

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎source/tutorials/installing-packages.rst‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,21 @@ please install the latest 3.x version from `python.org`_ or refer to the
5959
an introduction to using your operating system's shell and interacting with
6060
Python.
6161

62-
If you're using an enhanced shell like IPython or the Jupyter notebook, you
63-
can run system commands like those in this tutorial by prefacing them with
64-
a ``!`` character:
62+
.. Note:: If you're using an enhanced shell like IPython or the Jupyter
63+
notebook, you can run system commands like those in this tutorial by
64+
prefacing them with a ``!`` character:
6565

6666
::
6767

68-
In [1]: !python --version
68+
In [1]: import sys
69+
!{sys.executable} --version
6970
Python 3.6.3
7071

72+
It's recommended to write ``{sys.executable}`` rather than plain ``python`` in
73+
order to ensure that commands are run in the Python installation matching
74+
the currently running notebook (which may not be the same Python
75+
installation that the ``python`` command refers to).
76+
7177
.. Note:: Due to the way most Linux distributions are handling the Python 3
7278
migration, Linux users using the system Python without creating a virtual
7379
environment first should replace the ``python`` command in this tutorial

0 commit comments

Comments
 (0)