简体   繁体   中英

How to run python script with library inside Kernell terminal?

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'

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM