有没有办法在 macOS Big Sur 上使用 SageMath?

Is there any way to use SageMath on macOS Big Sur?

我在 mac 上下载了 SageMath-9.2,但每次我尝试使用笔记本时

通过 运行 在我的终端上“sage -n jupyter

我得到以下按摩:

Please wait while the Sage Jupyter Notebook server starts... 
Traceback (most recent call last): 
    File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/sage/repl/ipython_kernel/install.py", line 307, in have_prerequisites 
        from notebook.notebookapp import NotebookApp 
    File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/notebook/notebookapp.py", line 66, in 
        from tornado import httpserver 
    File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/tornado/httpserver.py", line 29, in 
        import ssl 
    File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/ssl.py", line 98, in
        import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'

The Jupyter notebook requires ssl, even if you do not use https. Install the openssl development packages in your system and then rebuild Python (sage -f python3).

而且由于某种原因我也无法打开该应用程序......每次我点击该应用程序时我都会收到一个小 window 说:

Jupyter Server failed to start 
For some reason the Jupyter server failed to start. Please check the log for clues, and have that information handy when asking for help.

我希望得到一些帮助,这对我来说非常重要,因为我的大学项目必须使用 SageMath。提前致谢

在 macOS Big Sur 上,有几种安装 SageMath 的方法

Sage 也可以在线使用

您当前的安装已下载 作为 macOS 应用程序,自带 Python 缺少 SSL 模块(出于许可证原因)。

要修复它:

  • 切换到 Sage 目录
  • 可选获取最新的开发版本
  • 将并行作业数设置为 运行
  • 摆脱那个贤者的Python
  • 配置
  • 可选择遵循 brew install 配置结束时的建议
  • 制作
$ DIR=/Applications/SageMath-9.2.app/Contents/Resources/sage
$ cd $DIR
$ git checkout develop
$ git pull origin develop --tags
$ MAKE='make -j8'
$ V=0
$ source .homebrew-build-env
$ make -s V=0 python3-clean
$ make -s V=0 configure
$ ./configure
$ make -s V=0

另一种解决问题的方法是使用 Sage提供的SageMath Jupyter内核 使用系统范围的 Jupyter(例如,已安装 通过自制软件)。

这应该可以实现该目标:

$ SAGE_LOCAL=`sage -c 'print(SAGE_LOCAL)'`
$ SAGE_KERNEL=$SAGE_LOCAL/share/jupyter/kernels/sagemath 
$ KERNELS=$HOME/Library/Jupyter/kernels
$ ln -s $SAGE_KERNEL $KERNELS