解决jupyter notebook无法连接/一直in[*]的问题。

最近有需求,要把几个库更新到最新版本。于是,耍个机灵,就用了pip review批量把所有库更新到最新版本了,然后再打开jupyter notebook就无法运行了,心累,倒腾了几个小时。最后是在Bing上找到的解决办法。

原因是在于 tornado 这个库,你可以用pip list看一下是否有这个库,而且最最最重要的是看一下它的版本,如果是6.0及以上,恭喜你,问题已经找到了。

解决方法:

#建议手打,复制网页的代码到命令行,可能会出现莫名其妙的字符错误
pip install tornado==5.1.1  

只要是小于6.0版本都能解决此问题,具体的原因我大概看了一下 tornado 的介绍,好像是6.0以后不支持py3了,不太清楚,总之成功解决了。

2021-9-18@更新

因为好多人都看到这里了,我觉得自己还是应该去查一下。在Tornado 官方文档中看到了6.0的release note。​​​​​​​

What’s new in Tornado 6.0

Mar 1, 2019

Backwards-incompatible changes

  • Python 2.7 and 3.4 are no longer supported; the minimum supported Python version is 3.5.2.
  • APIs deprecated in Tornado 5.1 have been removed. This includes the tornado.stack_context module and most callback arguments throughout the package. All removed APIs emitted DeprecationWarning when used in Tornado 5.1, so running your application with the -Wd Python command-line flag or the environment variable PYTHONWARNINGS=d should tell you whether your application is ready to move to Tornado 6.0.
  • .WebSocketHandler.get is now a coroutine and must be called accordingly in any subclasses that override this method (but note that overriding get is not recommended; either prepare or open should be used instead).

英文也很简单,意思就是Tornado 6.0不再支持py3.4及以下版本了,但是我估计好多人都是用不到这个库的,如果用到了Tornado,你大概率也不会找到这篇文章。

  • 所以两种方法,第一种最简单,直接降Tornado版本 < 6.0就好了
  • 还有一种就是升级你的py版本,至少是3.5.2,但升级py版本,其他库有没有支持也不好说,所以如果你必须要使用Tornado 6.0及以上版本,那么升级py版本的时候,最好先查看其他重要库是否支持。


2021-5-1 遇到一个内核一直启动失败的问题

最后查到了应该是公司防火墙设置的问题,导致内核一直连接失败。最后在stackoverflow这个回答中找到了解决办法:

jupyter notebook --no-browser --ip=0.0.0.0 --port=8888

  • 13
    点赞
  • 33
    收藏
    觉得还不错? 一键收藏
  • 15
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值