0

我首先使用以下方法从源代码构建 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

4

1 回答 1

3

通过首先使用卸载 mpmath 和 sympy 来修复它:

$brew uninstall sympy
$brew uninstall mpmath

然后重新安装它们:

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

现在一切正常!

于 2017-05-28T07:16:37.277 回答