错误:运行Octave时,在第62行第15列附近未定义'python_ipc_popen2'

时间:2020-06-02 14:19:03

标签: python python-3.x octave sympy

尝试在Mac上运行Octave。当我运行诊断命令sympref diagnose时。我知道一切配置都很好:

Symbolic package diagnostics
============================

Python and SymPy are needed for most features of the Symbolic package.

The Python interpreter is currently: "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3".

Computers may have more than one Python interpreter installed.  If you
need to, you can select a different one using the PYTHON environment
variable (see "help sympref").  For example, to use Python 2, try
    setenv PYTHON python2
    sympref reset

Attempting to run /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -c "print(\"Python says hello\")"

status = 0
output = Python says hello

Good, Python ran correctly.


Python version
--------------

Let's check what version of Python we are calling...

Attempting to run /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -c "import sys; print(sys.version)"

status = 0
output = 3.7.6 (v3.7.6:43364a7ae0, Dec 18 2019, 14:18:50)
[Clang 6.0 (clang-600.0.57)]


SymPy Python Library
--------------------

SymPy is a Python library used by Symbolic for almost all features.

Attempting to run /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -c "import sympy; print(sympy.__version__)"

status = 0
output = 1.6

SymPy must be at least version 1.2; you have version 1.6.

Good, a working version of SymPy is installed.


Python XML Parsing and DOM Support
----------------------------------

The XML DOM library is used by Symbolic for passing values to and from Python.
Some older versions of Python formatted XML output differently.  As long as you
have any reasonably recent version of Python, this should pass.

Attempting to run /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -c "import xml.dom.minidom as minidom; doc = minidom.parseString(\"<item>value</item>\"); print(doc.toprettyxml(indent=\"\"))"

status = 0
output = <?xml version="1.0" ?>
<item>value</item>



Your kit looks good for running the Symbolic package.  Happy hacking!

但是当我尝试声明变量syms x时,出现以下错误:

error: 'python_ipc_popen2' undefined near line 62 column 15
error: called from
    python_ipc_driver at line 62 column 13
    pycall_sympy__ at line 163 column 9
    valid_sym_assumptions at line 38 column 10
    assumptions at line 82 column 7
    syms at line 97 column 13

1 个答案:

答案 0 :(得分:0)

好的,我已经找到了解决方法。超级奇怪。 显然,Octave(或不确定SymPy,不确定)正在寻找一个名为Python的系统变量,在文档中用大写的 P 表示该变量应为PYTHON。无论如何,setenv Python <path to python>设置解决了这个问题。