使用macports安装后,Ipython3笔记本无法运行

时间:2015-12-08 23:03:18

标签: python-3.x ipython ipython-notebook macports

我用

安装了Python3.4版本的IPython和Ipython笔记本
sudo port install py34-ipython
sudo port install py34-notebook

目前我使用Python 3.4.3作为我的Python3版本。

如果我使用ipython3 notebook,则会弹出Web浏览器。但是,如果我尝试打开一个新笔记本,内核会立即关闭。

$ipython3 notebook
[W 18:02:47.712 NotebookApp] ipywidgets package not installed.  Widgets are unavailable.
[I 18:02:47.727 NotebookApp] Serving notebooks from local directory: /Users/MYNAME
[I 18:02:47.727 NotebookApp] 0 active kernels 
[I 18:02:47.727 NotebookApp] The IPython Notebook is running at: http://localhost:8888/
[I 18:02:47.727 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 18:03:27.826 NotebookApp] Creating new notebook in 
[W 18:03:28.518 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20151208180247 (::1) 9.24ms referer=http://localhost:8888/notebooks/Untitled67.ipynb?kernel_name=python3
[I 18:03:28.693 NotebookApp] Kernel started: bccd5587-5da7-47a3-9c8f-90947b4140eb
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 151, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 118, in _get_module_details
    return _get_module_details(pkg_main_name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 104, in _get_module_details
    spec = importlib.util.find_spec(mod_name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/util.py", line 86, in find_spec
    parent = __import__(parent_name, fromlist=['__path__'])
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ipykernel/__init__.py", line 2, in <module>
    from .connect import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ipykernel/connect.py", line 17, in <module>
    import jupyter_client
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/jupyter_client/__init__.py", line 7, in <module>
    from .manager import KernelManager, run_kernel
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/jupyter_client/manager.py", line 32, in <module>
    from .session import Session
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/jupyter_client/session.py", line 48, in <module>
    from zmq.eventloop.ioloop import IOLoop
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/__init__.py", line 3, in <module>
    from zmq.eventloop.ioloop import IOLoop
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/ioloop.py", line 35, in <module>
    from tornado.ioloop import PollIOLoop, PeriodicCallback
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/ioloop.py", line 57, in <module>
    import thread  # py2
  File "/Users/MYNAME/thread.py", line 10
    print old, new
            ^
SyntaxError: Missing parentheses in call to 'print'
[I 18:03:31.692 NotebookApp] KernelRestarter: restarting kernel (1/5)

1 个答案:

答案 0 :(得分:0)

文件/Users/MYNAME/thread.py采用Python 2语法。 切换到其他目录或删除此文件或更改此文件的名称。然后再次启动笔记本服务器。名称thread.py影响Python 2中标准库模块的名称.IPython使用相同的源代码运行Python 2和3并导入错误的文件。