美文网首页
SageMath折腾笔记

SageMath折腾笔记

作者: 粗识名姓 | 来源:发表于2019-02-23 13:01 被阅读0次

GitHub下载
安装无需多言,注意记住Select Sage home directory的路径(默认是系统当前用户目录),使用过程中经常用到。建议:C:\Users\用户名\Sage

2019-02-23_124727.png

安装完成后,开始菜单有三个快捷方式,对应三种使用途径,最简单常用的应该就是Notebook了,但是在中文系统中这个快捷方式有点问题,无法直接使用。

先打开SageMath 8.x Shell命令行模式,执行jupyter notebook
错误提示如下:

...
 File "/opt/sagemath-8.6/local/lib/python2.7/site-packages/traitlets/config/application.py"...
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 4: ordinal not in range(128)

参考:github issues
解决:执行命令前面插入LANG=zn
LANG=zn jupyter notebook

页面错误:

File "/opt/sagemath-8.6/local/lib/python2.7/site-packages/notebook/services/contents/filemanager.py", line 322, in _dir_model st = os.lstat(os_path) UnicodeEncodeError: 'ascii' codec can't encode characters in position 11-16: ordinal not in range(128)

参考:CSDN博文
解决:
修改文件SageMath 8.x安装目录下runtime\opt\sagemath-8.6\local\lib\python2.7\site-packages\notebook\services\contents\filemanager.py
代码322行改成:st = os.lstat(os_path.decode('utf-8').encode('gb18030'))

Notebook快捷方式修改:
mintty.exe参数改为 -t 'SageMath 8.6 Notebook Server' -i sagemath.ico /bin/bash --login -c 'LANG=zn /opt/sagemath-8.6/sage --notebook jupyter'

jupyter配置文件
SageMath 8.x安装目录下runtime\opt\sagemath-8.6\local\etc\jupyter\jupyter_notebook_config.py
修改方法参考

matplotlib中文字体配置 参考
SageMath 8.x shell没有集成字体相关命令,所以不能完全照着参考中的方法操作!
下面以微软雅黑字体的安装为例:

  1. 下载ttf格式的微软雅黑字体文件
  2. 解压至Sagemath 8.x目录下runtime\usr\share\fonts\microsoft
  3. 编辑用户目录中的文件\.sage\matplotlib-1.5.1\fontList.json
    在合适的位置插入下面代码
{
  "_class": "FontManager", 
  "ttflist": [
  ...
    {
      "style": "normal", 
      "name": "Microsoft YaHei", 
      "weight": "roman", 
      "fname": "/usr/share/fonts/microsoft/msyh.ttf", 
      "stretch": "normal", 
      "_class": "FontEntry", 
      "variant": "normal", 
      "size": "scalable"
    }, 
  ...
  ], 
  ...
  "ttffiles": [
  ...
    "/usr/share/fonts/microsoft/msyh.ttf", 
  ...
  ], 
  1. 如果有正在运行的Jupyter processes,需要关闭后重新运行才能生效。
    关闭正在运行的Jupyter processes

仍然存在的问题:路径中不能含有中文!尽管有些解决方案(参考),但似乎对SageMath中的jupyter无效!

升级命令
pip途径:pip install --upgrade notebook
conda途径:conda upgrade notebook
jupyter 和 notebook分别进行升级

相关文章

  • SageMath折腾笔记

    GitHub下载安装无需多言,注意记住Select Sage home directory的路径(默认是系统当前用...

  • 使用SageMath

    Sage(或称SageMath)是在GPL协议下发布的开源数学软件,并且整合了许多已有的开源软件包到一个基...

  • 在mac上安装SageMath

    下载https://mirrors.tuna.tsinghua.edu.cn/sagemath/osx/intel...

  • wsl2 ubuntu 18.04 中安装和使用 sagemat

    1. 帮助 sagecell--在线运行[https://sagecell.sagemath.org/] sage...

  • SageMath 9 in WSL with Debian 10

    Win10 中的WSL安装参考我的上一篇Windows10 玩SmartDNS告别污染中的部分说明 官方的Debi...

  • emacs 折腾笔记

    emacs 折腾笔记 我是个伪技术迷,技术上很仰慕那些开源界的大牛们,也梦想有朝一日,也能发扬先辈精神,用代码改变...

  • Ubuntu 折腾笔记

    记录 Ubuntu 使用过程中一些 环境配置、软件安装的方法。不定期更新。 环境配置 Java 环境配置(配置JD...

  • 《 Prometheus 折腾笔记 》

    最近以来都很想写写关于这段时间以来折腾 Prometheus 的心得,但是人总是有惰性的,拖延是会上瘾的。 正所谓...

  • 【Tool】一个CS研究生的笔记系统

    折腾了很长时间,目前没有一个理想的笔记系统能够简单易行地解决笔记、实验、代码管理问题,按照组合功能列出一些折腾历史...

  • 解决黑苹果卡在IOConsoleUsers: gIOScreen

    黑苹果10.12 sierra 安装笔记 再说感慨 有钱还是直接上mbp或者imac吧,比较折腾。 当然不想太折腾...

网友评论

      本文标题:SageMath折腾笔记

      本文链接:https://www.haomeiwen.com/subject/pctpyqtx.html