起因,我的 notebook所有的kernel都坏了,执行之后都没有真正的程序运行,打印不出结果(右边的kernel显示是可信任的,但就是执行不了语句)。无奈只能重装。
pip uninstall jupyter notebook
先卸载了。
pip install jupyter notebook
(安装的时候不能连vpn,不然容易报错)
安装成功了在终端输入jupyter notebook,报错,显示ModuleNotFoundError: No module named ‘zmq.asyncio’,一开始以为是zmq库没有装上,于是pip install zmq,但是报错AttributeError: ‘WindowsPath’ object has no attribute ‘read_text’。通过搜索后发现要执行这个语句pip install setuptools==50.3.2,再执行pip install zmq,又报错AttributeError: ‘WindowsPath’ object has no attribute ‘write_text’,通过搜索发现解决方案:pip uninstall pathlib。最后终于pip install zmq成功了。
但是,在终端输入jupyter notebook,发现还是报错ModuleNotFoundError: No module named ‘zmq.asyncio’,所以这个错误根本不是zmq库的原因,通过搜索发现解决方法为:pip uninstall zmq,pip install pyzmq。最后输入jupyter notebook终于跳转正常了!(这里还有个问题,我之前搞的那些虚拟环境的kernel还能看到,但是切换成那些kernel的时候会报错:无法定位程序输入点 于动态链接库(库的地址))下一步看下怎么把原来的kernel正常用上,不行的话要删掉重装。
所以zmq和pyzmq的关系是什么?有时间搜索一下。