mac上安装anaconda之后运行Notebook和jupyter都报错
我的mac是 Catalina,Intel Core
运行就是错误,没有办法运行
错误信息
base ❯
/Users/zhuxuemin/anaconda3/anaconda3/bin/jupyter_mac.command ; exit;
Traceback (most recent call last):
File "/Users/zhuxuemin/anaconda3/anaconda3/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/Users/zhuxuemin/anaconda3/anaconda3/lib/python3.9/site-packages/jupyter_core/application.py", line 269, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
File "/Users/zhuxuemin/anaconda3/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
app.initialize(argv)
File "/Users/zhuxuemin/anaconda3/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
return method(app, *args, **kwargs)
File "/Users/zhuxuemin/anaconda3/anaconda3/lib/python3.9/site-packages/notebook/notebookapp.py", line 2145, in initialize
self.init_resources()
File "/Users/zhuxuemin/anaconda3/anaconda3/lib/python3.9/site-packages/notebook/notebookapp.py", line 1704, in init_resources
resource.setrlimit(resource.RLIMIT_NOFILE, (soft, hard))
ValueError: current limit exceeds maximum limit
原因分析
看limit exceeds 根据经验来说是句柄数据不够了
1、获取当前文件描述符限制
ulimit -n
2048
2、获取当前进程数限制
ulimit -u
2784
这个是linux上面的命令,在mac上也是可以使用的。
mac自己的话也有专门的命令行
launchctl limit maxfiles
maxfiles 2048 65535
一个是当前,一个是最大,不管了,直接就开大招,我们把当前和上限一改
sudo launchctl limit maxfiles 65536 200000
这个需要root权限,会提示输入密码,再运行一下,结果就跑起来了
参考
https://wilsonmar.github.io/maximum-limits/