I'm trying to run python script from terminal, but it's giving me error.

I already installed from linux terminal library sympy 'pip install sympy'. But still it doesn't work

This error i get when trying to run python script file.

Traceback (most recent call last):
  File "script.py", line 2, in <module>
    from sympy import symbols, diff
ModuleNotFoundError: No module named 'sympy'

1 Answers

2
Abhijith On Best Solutions

Are you using two versions of Python?

python3.x uses pip3, and python2.x uses pip

1) Install pip3 on your system.

sudo apt install python3-pip

2) Install sympy by running

pip3 install sympy

3) Open python3 shell (run "python3" on your terminal) and import the necessary libraries

from sympy import symbols, diff