gpt4 book ai didi

amazon-web-services - 在 aws 上安装 ipython 笔记本时,Mycert.pem 不存在

转载 作者:行者123 更新时间:2023-12-03 09:10:49 25 4
gpt4 key购买 nike

我目前正在尝试在 aws 上安装 jupyter 笔记本。但出现错误,显示“mycert.pem”未退出。

我在本地终端上运行了以下行并在本地文档中获取 mykey.key 和 mycert.pem

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

我的 jupyter_notebook_config.py 中的代码

c= get_config()
c.IPKernelApp.pylab = 'inline' # if you want plotting support always in your notebook

c.NotebookApp.certfile = u'/Users/leigh/mycert.pem ' #location of your certificate file
c.NotebookApp.keyfile = u'/Users/leigh/mykey.key '
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.password = u'sha1:eaa28116dc5f:________'

当我在 aws 上运行“jupyter Notebook”时它显示以下错误

  File "/home/ec2-user/anaconda2/bin/jupyter-notebook", line 6, in <module>
sys.exit(main())
File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 591, in launch_instance
app.initialize(argv)
File "<decorator-gen-114>", line 2, in initialize
File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/notebook/notebookapp.py", line 1007, in initialize
self.init_webapp()
File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/notebook/notebookapp.py", line 868, in init_webapp
xheaders=self.trust_xheaders)
File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/tornado/util.py", line 215, in __new__
instance.initialize(*args, **init_kwargs)
File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/tornado/httpserver.py", line 155, in initialize
read_chunk_size=chunk_size)
File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/tornado/tcpserver.py", line 112, in __init__
self.ssl_options['certfile'])
ValueError: certfile "/Users/leigh/mycert.pem " does not exist

“/Users/leigh/mycert.pem”是本地笔记本电脑上 mycert.pem 的路径。

我有什么错吗D:?已经尝试解决这个问题几个小时了,但不知道发生了什么......非常感谢任何人都可以让我知道如何解决这个问题..

最佳答案

在 jupyter 配置文件夹中生成 key 和证书:

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout ~/.jupyter/key.key -out ~/.jupyter/cert.pem

编辑~/.jupyter/jupyter_notebook_config.py并添加:

import os
c.NotebookApp.keyfile = os.path.expanduser('~') + '/.jupyter/key.key'
c.NotebookApp.certfile = os.path.expanduser('~') + '/.jupyter/cert.pem'

关于amazon-web-services - 在 aws 上安装 ipython 笔记本时,Mycert.pem 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42717577/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com