【问题标题】:Jupyter Notebook from command line - ImportError - cannot import name 'TYPE'命令行中的 Jupyter Notebook - ImportError - 无法导入名称'TYPE'
【发布时间】:2019-03-21 04:58:17
【问题描述】:
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'

【问题讨论】:

  • 以上是我在运行命令“jupyter notebook”时收到的错误。我期待在我的网络浏览器中打开一个新的 jupyter 笔记本。任何帮助将不胜感激。

标签: command-line jupyter-notebook jupyter


【解决方案1】:

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

Python 3.5.1 没有 typing.Type

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

【讨论】:

    【解决方案2】:

    我遇到了完全相同的问题。我正在运行 Windows 7 64 位,在 Portable 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 工作了!

    【讨论】:

      猜你喜欢
      • 2021-04-25
      • 2021-06-13
      • 2019-03-23
      • 2021-08-05
      • 1970-01-01
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 2017-10-09
      相关资源
      最近更新 更多