I'm trying to use the symbolic package with Octave.
When I try to use sympref diagnose
in Octave I get the error:
Symbolic package diagnostics
============================
Python and SymPy are needed for most features of the Symbolic package.
The Python interpreter is currently: "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 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 python3 -c "import sys; print(sys.version)"
status = 0
output = 3.7.3 (default, May 6 2019, 01:39:47)
[Clang 9.0.0 (clang-900.0.39.2)]
SymPy Python Library
--------------------
SymPy is a Python library used by Symbolic for almost all features.
Attempting to run python3 -c "import sympy; print(sympy.__version__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'sympy'
status = 1
output =
Unfortunately status was non-zero: probably Python cannot import sympy.
* Is there an error message above?
* Do you have SymPy installed? If not, please try to install it and
try again.
* If you do have SymPy installed, maybe it's installed for a different
Python interpreter than the one we found? Please try "setenv" as
described above to change your python interpreter.
However, I do have Sympy installed. If I run it on the terminal I get:
Python 3.8.5 (default, Sep 4 2020, 02:22:02)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import *
>>> x=Symbol('x')
>>> integrate(1/x, x)
log(x)
So Sympy works fine. The problem seems to be that the terminal uses Python 3.8.5 and Octave uses Python 3.7.3.
When I try to use >> setenv PYTHON python3.8
to change the version Octave uses from 3.7 to 3.8, I get an error message asking me if Python is installed.
When I try to run Python 3.7 from the terminal I get the error:
command not found: python3.7
What am I doing wrong and how can I fix it?
question from:
https://stackoverflow.com/questions/65907438/octave-reading-wrong-version-of-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…