1

我按照设置 ipython3 服务器的说明进行操作。

这是我的ipython_notebook_config.py

c.NotebookApp.ip = '*'
c.NotebookApp.certfile = u'/home/ed/.ipython/profile_default/ds.pem'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha512:..mykey...'
c.NotebookApp.port = 20000

当我启动笔记本时,这就是我得到的:

ipython3 notebook                                                                                 ~
[I 19:51:50.443 NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js
[I 19:51:50.476 NotebookApp] Serving notebooks from local directory: /home/ed
[I 19:51:50.476 NotebookApp] 0 active kernels 
[I 19:51:50.476 NotebookApp] The IPython Notebook is running at: https://[all ip addresses on your system]:20000/
[I 19:51:50.476 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation)

当我尝试从外部连接到这台机器时,出现错误:

[E 19:52:02.413 NotebookApp] Exception in callback (<socket.socket fd=5, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('0.0.0.0', 20000)>, <function wrap.<locals>.null_wrapper at 0x7f766269a488>)
    Traceback (most recent call last):
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/ioloop.py", line 866, in start
        handler_func(fd_obj, events)
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/netutil.py", line 265, in accept_handler
        callback(connection, address)
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/tcpserver.py", line 239, in _handle_connection
        do_handshake_on_connect=False)
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/netutil.py", line 501, in ssl_wrap_socket
        context = ssl_options_to_context(ssl_options)
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/netutil.py", line 478, in ssl_options_to_context
        context.load_cert_chain(ssl_options['certfile'], ssl_options.get('keyfile', None))
    ssl.SSLError: [SSL] PEM lib (_ssl.c:2536)

我已经在另外两台机器上设置了这个,我没有问题。我不知道出了什么问题,可能是缺少库或一些我看不到的字幕错误。

我在 Ubuntu 15.04 上使用 IPython 3.2.1.、Python 3.4.3。

有任何想法吗?

4

3 回答 3

0

使用修改后的 opessl 命令

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.key -out mycert.pem

来自@GeQi 并确保在浏览器中使用 HTTPS 对我有用。

于 2015-11-09T14:07:05.597 回答
0

检查 1:更新 AWS EC2 安全组中 22、443、8888 的入站规则。

检查 2:确保使用以下命令在 certs 文件夹中创建 mycert.pem 文件:

$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem

检查 3: passwd() > 保存 SHA 密钥并在 jupyter_notebook_config.py 中添加该密钥

检查 4:使用https://public-DNS-of-EC2-Instance:8888 如果连接不是私有的,则继续进行高级...

更多详情: https ://github.com/prakashpy/miscellaneous/tree/master/jupyter-notebook-on-aws-ec2

于 2018-10-04T03:24:49.433 回答
-1

Jupyter 和 IPython 的未来

IPython 是一个不断发展的项目,具有越来越多与语言无关的组件。IPython 3.x 是 IPython 的最后一个单一版本,包含笔记本服务器、qtconsole 等。从 IPython 4.0 开始,项目的语言无关部分:笔记本格式、消息协议、qtconsole、笔记本 Web 应用程序等。已经转移到名为 Jupyter 的新项目中。IPython 本身专注于交互式 Python,其中一部分是为 Jupyter 提供 Python 内核。

简而言之,notebook 不再是 IPython 项目的一部分,因此您应该寻找“Jupyter notebook”的关键字。切换到较新的 Jupyter notebook 相当容易,只需按照文档(从此处此处)安装模块并设置公共服务器。程序几乎相同。但是,在完成所有这些后,我仍然遇到相同的 SSLError。我在 github repo 中找到了解决方案:

在对 openssl 参数进行轻微更改后,它对我有用。我将密钥和证书都保存在同一个文件“mycert.pem”中。原文:$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.key -out mycert.pem 我的版本:$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem

有些人报告说这对他们来说行不通,而且问题还没有解决,尽管这对我来说非常有效。此外,您可能需要清理以前的配置。

# remove the earlier created ipython profile
$ ipython profile locate nbserver
/home/ubuntu/.ipython/profile_nbserver
$ rm -r /home/ubuntu/.ipython/profile_nbserver
$ ipython profile locate nbserver
[ProfileLocate] CRITICAL | Profile 'nbserver' not found.
于 2015-10-12T04:40:22.213 回答