这是我第一次接触 sympy。我正在使用带有 pythong 的 DEbian Bullseye。我安装了 git 然后“git clone https://github.com/sympy/sympy.git" 之后:
abraca@SS:~/SymPy$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import *
>>> x = symbols('x')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'symbols' is not defined
>>> quit()
我做错了什么?
这是我的树的样子,从我的根目录开始:
abraca@SS:~$ ls SymPy/sympy/sympy
abc.py core integrals polys tensor
algebras crypto interactive printing testing
assumptions diffgeom liealgebras release.py this.py
benchmarks discrete logic sandbox unify
calculus external matrices series utilities
categories functions multipledispatch sets vector
codegen galgebra.py ntheory simplify
combinatorics geometry parsing solvers
concrete holonomic physics stats
conftest.py __init__.py plotting strategies
答案 0 :(得分:1)
通过 git 安装 sympy 从未奏效。这是有效的(注意所有重要的 3,放在 python
之后,而不是 pip
):
sudo apt install python3-pip
pip3 install sympy
从那时起一切正常:
abraca@SS:~$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from sympy import *
>>> x=symbols('x')
>>> limit(sin(x)/x,x,0)
1
>>> quit()
abraca@SS:~$