Skip to content Skip to sidebar Skip to footer

Using Bash Commands In Jupyter Notebook

I never used bash with jupyter notebook. For some project, I need to use bash with python but it's giving me errors. I have installed bash kernel also. PATH='/Downloads/dogscats/'

Solution 1:

It is possible to use bash commands in Jupyter Notebook, even on Windows systems, as long as Jupyter is launched from a bash-compliant command line such as Git Bash (MingW64). As shown in the OP's code example, the bash command must be prepended by an exclamation mark (!).

The real key, however, is launching from Git Bash or possibly Ubuntu on Windows .

I'm running windows 10 Pro with Python installed via Anaconda, and the following code works when I launch Jupyter via Git Bash, but does not when I launch from the Anaconda prompt.

>>> !ls
database.sqlite
Weather Data Clustering using k-Means.ipynb

>>>!pip show lxml | grep Version
Version: 4.1.0

Solution 2:

Installing Git Bash for Windows did it to me. After that, run the jupyter notebook from there.

Post a Comment for "Using Bash Commands In Jupyter Notebook"