1

Jupyter notebook does not work anymore after typing command !python on a cell. It accepts all other python codes, terminal and bash codes, codes like !pip list and !python -V but not !python. It acts same in Azure Notebooks also. What could be the logic behind this?

enter image description here

Merin Nakarmi
  • 3,148
  • 3
  • 35
  • 42
  • 3
    Yes, cell with command !python is running infinitely, so you will have to Restart or interrupt IPython kernel. I'm not sure what is wrong with some Jupyter and Azure notebook. However at present command !python is working in Google Colab https://colab.research.google.com/ – Kishan Jan 25 '20 at 09:52
  • May be it's the python version or the environment, I'm not sure. But what exactly are you trying to achieve with command !python ? – Kishan Jan 25 '20 at 09:55
  • If you are trying to call a Python script to run, `%run script.py` is the more full-featured way to do it in a notebook; however, if environment set up right `!python script.py` will work, too. – Wayne Jan 25 '20 at 20:19
  • If you are looking to bring up a python console/interpreter, go to the terminal by clicking on Jupyter logo in upper left and opening a new terminal. Typing `python` in terminal will get you that. But what you are trying to do in the notebook will cause it to hang because it is executing that off in a separate shell awaiting more input that you cannot provide. – Wayne Jan 25 '20 at 20:26

0 Answers0