Jupyter Notebook from command line - ImportError -

2019-09-01 03:47发布

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条回答
【Aperson】
2楼-- · 2019-09-01 04:18

I had the same issue, here's how I solved it

Python 3.5.1 doesn't have 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'
>>>

so I upgraded my python version to 3.5.4 by running below command which resolved the issue

conda update --all

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

查看更多
可以哭但决不认输i
3楼-- · 2019-09-01 04:19

I had the exact same problem. I am running windows 7 64-bit, running on Portable Python 3.7.3.

When Jupyter was failing, I was running Portable Python at this path:

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

Uninstalling and reinstalling Jupyter, typing modules did not solve the problem.

I was suspicions of problematic path-names, so I copied the python installation to a path without whitespaces (and maybe a shorter path?):

E:\applications\python37\Python

Finally, I managed to get Jupyter Notebook to work!

查看更多
登录 后发表回答