从命令行Jupyter Notebook-ImportError-无法导入名称'TYPE'

时间:2019-03-21 04:58:17

标签: command-line jupyter-notebook jupyter

Traceback (most recent call last):
  File "/Users/codymitchell/Documents/code/py/zipline/venv/bin/jupyter-notebook", line 6, in <module>
    from notebook.notebookapp import main
  File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/notebook/__init__.py", line 25, in <module>
    from .nbextensions import install_nbextension
  File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/notebook/nbextensions.py", line 610, in <module>
    from .extensions import (
  File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/notebook/extensions.py", line 8, in <module>
    from tornado.log import LogFormatter
  File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/tornado/log.py", line 34, in <module>
    from tornado.escape import _unicode
  File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/tornado/escape.py", line 27, in <module>
    from tornado.util import unicode_type
  File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/tornado/util.py", line 21, in <module>
    from typing import (
ImportError: cannot import name 'Type'

2 个答案:

答案 0 :(得分:1)

我有完全相同的问题。我正在运行Windows 7 64位,并在可移植Python 3.7.3上运行。

当Jupyter失败时,我正在以下路径上运行Portable Python:

E:\applications\python37\Portable Python-3.7.3\App\Python

卸载并重新安装Jupyter,输入模块不能解决问题。

我怀疑路径名有问题,因此我将python安装复制到没有空格的路径(也许是更短的路径?):

E:\applications\python37\Python

最后,我设法让Jupyter Notebook工作!

答案 1 :(得分:0)

我遇到了同样的问题,这就是我的解决方法

Python 3.5.1没有类型。

https://github.com/django-extensions/django-extensions/issues/1188

C:\Users\rigupta>D:\Anaconda3\python
Python 3.5.1 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import typing
>>> typing.Type
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'typing' has no attribute 'Type'
>>> typing.type
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'typing' has no attribute 'type'
>>>

所以我通过运行下面的命令将python版本升级到3.5.4,

conda update --all

https://www.youtube.com/watch?v=Q-dZCAk1tfc