Octave:使用符号包

时间:2017-05-26 05:23:42

标签: python octave sympy importerror mpmath

我首先使用以下方法从源代码构建Octave:

$brew install --build-from-source octave

然后我使用以下方法在八度音程内安装了符号包:

$pkg install -forge symbolic 

之后我做了:

$pkg load symbolic

在使用syms函数时,它给出了一个没有安装Sympy的ImportError。所以,我用:

安装了Sympy
$sudo pip install --user sympy

之后我再次尝试使用syms,现在它出现了这个错误:

 Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File "/Library/Python/2.7/site-packages/sympy/__init__.py", line 20, in <module>
 raise ImportError("SymPy now depends on mpmath as an external library. "
 ImportError: SymPy now depends on mpmath as an external library. See 
 http://docs.sympy.org/latest/install.html#mpmath for more information.
 OctSymPy v2.5.0: this is free software without warranty, see source.
 Initializing communication with SymPy using a popen2() pipe.
 error: Python cannot import SymPy: have you installed SymPy?
 error: called from
 assert_have_python_and_sympy at line 37 column 5
 python_ipc_popen2 at line 78 column 5
 python_ipc_driver at line 58 column 13
 python_cmd at line 164 column 9
 valid_sym_assumptions at line 38 column 10
 assumptions at line 82 column 7
 syms at line 97 column 13

请告诉我如何解决这个问题 操作系统:macOS Sierra 10.12.4
GNU Octave,版本4.2.1

1 个答案:

答案 0 :(得分:2)

通过首先使用:

卸载mpmath和sympy来解决此问题
$brew uninstall sympy
$brew uninstall mpmath

然后重新安装它们:

$pip install --user mpmath
$pip install --user sympy

现在一切正常!