简体   繁体   中英

import "Sympy" couldn't be resolved

Line:3 Import "sympy" couldn't be resolved

I have installed sympy using pip in my virtual environment. Why am I getting this error? When I run this code I am am getting the following error:

Traceback (most recent call last):
  File "x:\path\NumericalMethods.py", line 3, in <module>
    import sympy
ModuleNotFoundError: No module named 'sympy'

Here are the modules that are installed:

altgraph==0.17
et-xmlfile==1.1.0
future==0.18.2
mpmath==1.2.1
numpy==1.20.3
openpyxl==3.0.7
panda3d==1.10.9
pandas==1.2.4
pefile==2019.4.18
pyinstaller==4.3
pyinstaller-hooks-contrib==2021.1
PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.9.0
PyQt5Designer==5.14.1
python-dateutil==2.8.1
pytz==2021.1
pywin32-ctypes==0.2.0
six==1.16.0
sympy==1.8
unit-converter==1.1.0
xlrd==2.0.1

The first step is to check whether you are running the code in the virtual environment, to verify that refer the below image

VS 代码环境

If you are not in a virtual environment that you have created just click that red box that I have marked in that pic and select the respective virtual environment Interpreter (python.exe).

Some IDE's have virtual environments. If so, you can't just open cmd, but you need to find the terminal that comes from your IDE to install librarys

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