ImportError:没有名为shutil_get_terminal_size的模块

时间:2017-01-30 04:24:10

标签: python scipy ipython

我已经开始使用以下方式安装SciPy:

pip install --user numpy scipy matplotlib ipython jupyter pandas simply nose

它安装但是当我想进入ipython时,我收到了这个错误:

ImportError: No module named shutil_get_terminal_size

我尝试卸载python然后重新安装它以及卸载并重新安装SciPy。我还升级了pip设置工具以及python。它说已经安装了shutil_get_terminal_size:

Traceback (most recent call last):
  File "/usr/local/bin/ipython", line 7, in <module>
    from IPython import start_ipython
  File "/usr/local/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
    from .core.application import Application
  File "/usr/local/lib/python2.7/site-packages/IPython/core/application.py", line 25, in <module>
    from IPython.core import release, crashhandler
  File "/usr/local/lib/python2.7/site-packages/IPython/core/crashhandler.py", line 28, in <module>
    from IPython.core import ultratb
  File "/usr/local/lib/python2.7/site-packages/IPython/core/ultratb.py", line 128, in <module>
    from IPython.utils.terminal import get_terminal_size
  File "/usr/local/lib/python2.7/site-packages/IPython/utils/terminal.py", line 22, in <module>
    from backports.shutil_get_terminal_size import get_terminal_size as _get_terminal_size
ImportError: No module named shutil_get_terminal_size

我只需要能够让SciPy和ipython工作。

2 个答案:

答案 0 :(得分:1)

您需要更新您的pip版本,然后再次安装ipython。

sudo pip install --upgrade setuptools pip
pip uninstall --user ipython
pip install --user ipython

答案 1 :(得分:0)

我也面临同样的问题。这是conda环境的问题。这就是它在ipython notebook中给出错误的原因。试试这个。

conda update conda

conda update ipython

尝试此操作后,如果您遇到同样的问题。然后尝试在您的conda环境中安装ipython。首先激活您的conda环境。然后执行以下操作。

     pip install --upgrade setuptools pip
  ex:  (dato-env) pydev@Optimus:~$ pip install --upgrade setuptools pip

然后在conda环境中安装ipython

    pip install -U ipython
    ex : (dato-env) pydev@Optimus:~$ pip install -U ipython
然后从终端打开Jupyter笔记本,它将在你的浏览器上打开jupyter。

(dato-env) pydev@Optimus:~$ jupyter notebook

希望它有所帮助。