Код: Выделить всё
from sympy.parsing.latex import parse_latex
print(type(parse_latex))
latex_string = r"2 x + 4"
expr = parse_latex(latex_string) # error here
print(expr)
# TypeError: 'NoneType' object is not callable
Код: Выделить всё
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[219], line 2
1 latex_string = r"2 + 4"
----> 2 parse_latex(latex_string)
3 print(expr)
File ...\sympy\parsing\latex\__init__.py:199, in parse_latex(s, strict, backend)
194 _latex = import_module(
195 'sympy.parsing.latex._parse_latex_antlr',
196 import_kwargs={'fromlist': ['X']})
198 if _latex is not None:
--> 199 return _latex.parse_latex(s, strict)
200 elif backend == "lark":
201 return parse_latex_lark(s)
File ...\sympy\parsing\latex\_parse_latex_antlr.py:74, in parse_latex(sympy, strict)
71 matherror = MathErrorListener(sympy)
73 stream = antlr4.InputStream(sympy)
---> 74 lex = LaTeXLexer(stream)
75 lex.removeErrorListeners()
76 lex.addErrorListener(matherror)
TypeError: 'NoneType' object is not callable
Версии — Python 3.14.0. и СимПи 1.14. Я работаю в Jupyter Notebook.
Буду признателен за любую помощь.
Подробнее здесь: https://stackoverflow.com/questions/798 ... arse-latex
Мобильная версия