Jupyte笔记本,为什么我从一开始就有1个以上的线程?
我已经在互联网上搜索过,但似乎以前没人问这个问题。
我正在学习python线程。
当我在VSCDOE上的Jupyter笔记本上运行此代码时 (这是一个新文件,只有内部的代码)
import threading
print(threading.active_count()) # 6
我已经尝试过CMD和Pycharm,它们都显示 1 是主线程。
我很好奇其他5个线程来自Jupyter Notebook。
此问题仅出现在Jupyter笔记本上。
我想念什么吗?
任何提示或建议都很棒!
I have searched on the Internet, but it seems no one asked this question before.
I am learning python threading.
When I run this code on my Jupyter notebook on VScdoe
(it's a new file, and only has this code inside)
import threading
print(threading.active_count()) # 6
I have tried on cmd and pyCharm, both of them show 1 which is the main thread.
I am curious where are the other 5 threads coming from on Jupyter notebook.
And this issue only appears on Jupyter notebook.
Did I miss something?
Any tips or suggestions would be awesome!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
其他线程由Jupyter笔记本,Ipython及其服务使用。
您可以打印他们的名称W,然后查看哪些服务使用线程
for Istance,我的Jupyter笔记本电脑不使用我的代码打印中的线程
The other threads are used by Jupyter notebook, IPython and their services.
You can print their namew and see which services are using threads with
For istance, my Jupyter notebook which does not make use of threads in my code prints