如何在 Ubuntu 20.04 上安装 Sagemath?

如何在 Ubuntu 20.04 上安装 Sagemath?

为什么在 Ubuntu 上安装 Sagemath 会失败?我试过了

jaakko@jaakko-Aspire-E1-572:~$ sudo apt install sagemath-common
[sudo] password for jaakko: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  sagemath-common
0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
Need to get 16,2 MB of archives.
After this operation, 205 MB of additional disk space will be used.
Get:1 http://fi.archive.ubuntu.com/ubuntu focal/universe amd64 sagemath-common all 9.0-1ubuntu4 [16,2 MB]
Fetched 16,2 MB in 4s (3 888 kB/s)            
Selecting previously unselected package sagemath-common.
(Reading database ... 216481 files and directories currently installed.)
Preparing to unpack .../sagemath-common_9.0-1ubuntu4_all.deb ...
Unpacking sagemath-common (9.0-1ubuntu4) ...
Setting up sagemath-common (9.0-1ubuntu4) ...
/usr/lib/python3/dist-packages/sage/combinat/root_system/branching_rules.py:1753
: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if len(stypes) is not 2:
/usr/lib/python3/dist-packages/sage/graphs/graph_latex.py:1159: SyntaxWarning: '
str' object is not callable; perhaps you missed a comma?
  raise TypeError('%s option must be a dictionary, not %s' (name, value))
/usr/lib/python3/dist-packages/sage/graphs/graph_latex.py:1168: SyntaxWarning: '
str' object is not callable; perhaps you missed a comma?
  raise TypeError('%s option must be a dictionary, not %s' (name, value))
/usr/lib/python3/dist-packages/sage/graphs/graph_latex.py:1175: SyntaxWarning: '
str' object is not callable; perhaps you missed a comma?
  raise TypeError('%s option must be a dictionary, not %s' (name, value))
/usr/lib/python3/dist-packages/sage/graphs/graph_latex.py:1182: SyntaxWarning: '
str' object is not callable; perhaps you missed a comma?
  raise TypeError('%s option must be a dictionary, not %s' (name, value))
/usr/lib/python3/dist-packages/sage/graphs/graph_latex.py:1189: SyntaxWarning: '
str' object is not callable; perhaps you missed a comma?
  raise TypeError('%s option must be a dictionary, not %s' (name, value))
/usr/lib/python3/dist-packages/sage/graphs/graph_latex.py:1196: SyntaxWarning: '
str' object is not callable; perhaps you missed a comma?
  raise TypeError('%s option must be a dictionary, not %s' (name, value))
/usr/lib/python3/dist-packages/sage/graphs/graph_latex.py:1203: SyntaxWarning: '
str' object is not callable; perhaps you missed a comma?
  raise TypeError('%s option must be a dictionary, not %s' (name, value))
Processing triggers for man-db (2.9.1-1) ...
jaakko@jaakko-Aspire-E1-572:~$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.0, Release Date: 2020-01-01                     │
│ Using Python 3.8.5. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
Traceback (most recent call last):
  File "/usr/share/sagemath/bin/sage-ipython", line 12, in <module>
    from sage.repl.interpreter import SageTerminalApp
  File "/usr/lib/python3/dist-packages/sage/repl/interpreter.py", line 105, in <module>
    from sage.repl.preparse import preparse, containing_block
  File "/usr/lib/python3/dist-packages/sage/repl/preparse.py", line 227, in <module>
    from sage.repl.load import load_wrap
  File "/usr/lib/python3/dist-packages/sage/repl/load.py", line 19, in <module>
    from sage.cpython.string import str_to_bytes, bytes_to_str, FS_ENCODING
ModuleNotFoundError: No module named 'sage.cpython.string'
jaakko@jaakko-Aspire-E1-572:~$ 

答案1

要安装 Sage Math,请输入命令sudo apt install sagemath

sagemath-common(您安装的)是整个软件包的众多依赖项之一。当您安装时sagemath,它会自动安装所有必需的依赖项。

答案2

现在建议使用 9.7 或更高版本(https://doc.sagemath.org/html/en/installation/linux.html

所以我找到了这个指导它帮助我在 Jupyter 中安装并运行 SageMath

相关内容