python - 有没有办法在 macOS Big Sur 上使用 SageMath?
问题描述
我在我的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).
而且由于某种原因我也无法打开该应用程序.....每次单击该应用程序时,我都会看到一个小窗口说:
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
- 使用康达:https ://doc.sagemath.org/html/en/installation/conda.html
- 从源代码构建,尽可能多地使用 Homebrew 软件包: https ://doc.sagemath.org/html/en/installation/source.html
- 使用 CoCalc-Docker:https ://github.com/sagemathinc/cocalc-docker
Sage 也可以在线使用
- 粘合剂
- CoCalc:https ://cocalc.com
- SageCell:https ://sagecell.sagemath.org
您当前的安装是作为 macOS 应用程序下载的,该应用程序带有自己的 Python,但缺少 SSL 模块(出于许可原因)。
要修复它:
- 切换到 Sage 目录
- 可选择获取最新的开发版本
- 设置并行运行的作业数
- 摆脱那个 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 一起使用(例如,通过 Homebrew 安装)。
这应该实现该目标:
$ 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
推荐阅读
- curl - 使用 certpath 初始化 NSS:sql:/etc/pki/nssdb 错误
- firebase - Kotlin suspendCancellableCoroutine 返回集合
- java - “Java Runtime Environment 检测到致命错误:”在 JDK eclipse 上运行 Java Project 时
- php - 在 PHP Linux Azure Web App 中,$_SERVER['REQUEST_METHOD'] 始终设置为 GET,即使 POST、PATCH、DELETE 等请求是通过 Postman 发出的
- excel - 如何删除列中的重复值但仅在 VBA 中的空行之间?
- tensorflow - 在 TF2.x 中使用 tf.while_loop 的第二个梯度返回 None
- android - 房间 Android 中的日期转换器
- excel - 当提供的值在其限制范围内时,字节数据类型出现溢出错误
- r - How to put expression in ggplot title/label/legend from character vector?
- c++ - 如何创建无效的 QModelIndex?