相关文章推荐
寂寞的数据线  ·  JavaScript ...·  10 月前    · 
爱笑的紫菜汤  ·  python dataframe ...·  1 年前    · 
傲视众生的警车  ·  spring ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

When i try to use from IPython.display import clear_output, display_html , then i show the error:

(ImportError: No module named IPython)

I am using Python 2.7.13, and im trying to make the game of life from John Conway. I am following this link: http://nbviewer.jupyter.org/url/norvig.com/ipython/Life.ipynb

I have read another questions and answers about it, but any answer works for me. First, this error is showed in command line, and when i try to run this code in a file. Second, this error is direct to IPython, not submodule or something similiar.

Which IPython version do you have? Can you check with running in terminal ipython --version niraj Jul 19, 2017 at 2:27 Try typing 'jupyter qtconsole' and see if an iPython terminal opens. If so it will tell you that ipython is installed and it will list version number. Natsfan Jul 19, 2017 at 3:03 Ok. I checked ipython --version but i havent it in my computer. Then, i wrote pip install ipython , but i got this error: Jhonatan Jul 19, 2017 at 23:24 Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\johathan\\appdata\\local\\temp\\pip-build-livxvv\\scandir\\setup.py';f=getattr(tokenize, 'open', open)( file );code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file , 'exec'))" install --record c:\users\johathan\appdata\local\temp\pip-fqwttt-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\johathan\appdata\local\temp\pip-build-livxvv\scandir\ Jhonatan Jul 19, 2017 at 23:24
  • I wrote ipython --version but i found, it was not installed.
  • I tried to install it, with pip. I went to C:\Python27\Scripts , here is pip, you can try in this directory, or add to environment variables.
  • I tried to install ipython, but i found a error
  • error: Unable to find vcvarsall.bat

    so i installed visual studio c++ 9.0, the version to python 2.7.

  • pip install ipython
  • If you are using Anaconda (the full version) ipython comes preinstalled. If you are using Miniconda or if the ipython is deleted for some reason you can re-install with

    conda install -c anaconda ipython
    

    If you are using it with jupyter. You might want to register the ipython with a user.

    python -m ipykernel install [--user] [--name <machine-readable-name>] [--display-name <"User Friendly Name">]
    

    Reference :

  • Official Documentation
  • I have a similar issue, but it appears when I was running the script under sudo. Fast and easiest way was to install IPython under sudo.

    sudo pip3 install IPython
    

    I am running a script that uses IPython module, in my terminal. If you are also trying to do something similar, this answer might help you.

    !pip3 install IPython
    

    Things to keep in mind:-

  • 'I' and 'P' in IPython are uppercase.
  • I am running the above command in python 3.7.
  • For me, the problem (that drove me crazy) is that I actually needed capitalization. The correct import after pip install is:

    from IPython.display import display, update_display
            

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.