【问题标题】:jupyter notebook setup failed with “TypeError: __call__() takes exactly 2 arguments (1 given)”jupyter notebook 设置失败,出现“TypeError:__call__() 恰好需要 2 个参数(给定 1 个)”
【发布时间】:2017-02-07 09:01:51
【问题描述】:

我用 pip 安装了 jupiter 并运行

jupyter notebook

然后我得到了这个错误:

Traceback (most recent call last):
  File "/usr/local/bin/jupyter-notebook", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/notebook/notebookapp.py", line 1136, in initialize
    super(NotebookApp, self).initialize(argv)
  File "<decorator-gen-6>", line 2, in initialize
  File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/jupyter_core/application.py", line 243, in initialize
    self.migrate_config()
  File "/Library/Python/2.7/site-packages/jupyter_core/application.py", line 162, in migrate_config
    from .migrate import get_ipython_dir, migrate
  File "/Library/Python/2.7/site-packages/jupyter_core/migrate.py", line 35, in <module>
    from IPython.paths import get_ipython_dir
  File "/Library/Python/2.7/site-packages/IPython/__init__.py", line 49, in <module>
    from .terminal.embed import embed
  File "/Library/Python/2.7/site-packages/IPython/terminal/embed.py", line 18, in <module>
    from IPython.terminal.interactiveshell import TerminalInteractiveShell
  File "/Library/Python/2.7/site-packages/IPython/terminal/interactiveshell.py", line 93, in <module>
    class TerminalInteractiveShell(InteractiveShell):
  File "/Library/Python/2.7/site-packages/IPython/terminal/interactiveshell.py", line 138, in TerminalInteractiveShell
    highlighting: \n %s""" % ', '.join(get_all_styles())
  File "/Library/Python/2.7/site-packages/pygments/styles/__init__.py", line 79, in get_all_styles
    for name, _ in find_plugin_styles():
  File "/Library/Python/2.7/site-packages/pygments/plugin.py", line 62, in find_plugin_styles
    for entrypoint in iter_entry_points(STYLE_ENTRY_POINT):
  File "/Library/Python/2.7/site-packages/pygments/plugin.py", line 45, in iter_entry_points
    import pkg_resources
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
    import packaging.requirements
  File "/Library/Python/2.7/site-packages/packaging/requirements.py", line 59, in <module>
    MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)

有人知道怎么解决吗? 我在谷歌上搜索过,但对这个特定问题没有任何帮助。

【问题讨论】:

    标签: python jupyter


    【解决方案1】:

    我遇到了同样的问题,但只在我机器上的两个 virtualenv 之一中。在 Python-2.7.9 上运行的两个环境中,我都有最新的 pip 和相同版本的 jupyter

    通过搜索,我发现了一个similar issue,它建议使用特定版本的 setuptools

    pip install setuptools==33.1.1
    

    我的 setuptools 版本是 setuptools-34.2.0 之前的版本。

    【讨论】:

      【解决方案2】:

      一开始我用的是 python 2.7.10 ,会报错。将python版本改为2.7.13,重新安装jupyter后,问题解决了:)

      可能很简单,但真的很有帮助!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-06-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-02-14
        • 2015-01-21
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多