How to install sympy package in python

35,698

Solution 1

Agree with Dixit.

First Solution:

It's okay to use pip3 install sympy on MacOS.

  1. List item
  2. Open your "Terminal".
  3. Input pip3 install sympy and press enter.
  4. It will automatically download and install the Sympy Package.

Second Solution:

Using git. # Notice: Before install Sympy, it's necessary to install "mpmath". Like the First Solution,

  • 1) Open "Terminal";
  • 2) Input pip3 install mpmath

After installing "mpmath", then,

  1. List item
  2. Open your "Terminal" on MacOS or "win+r", then input "cmd" in Windows.
  3. Input "git clone git://github.com/sympy/sympy.git" and press enter;
  4. Input "python setup.py install"

After finish installation, you can open the Python IDLE and try:

from sympy import Symbol, cos
x = Symbol('x')
e = 1/cos(x)
print(e.series(x, 0, 10))
# Result
# 1 + x**2/2 + 5*x**4/24 + 61*x**6/720 + 277*x**8/8064 + O(x**10)

If the code works, it shows that your "Sympy" package has already been installed.

Solution 2

In anaconda navigator:

  1. Click Environments (on the left)
  2. Choose your environment (if you have more than one)
  3. On the middle pick "All" from dropbox ("installed" by default)
  4. Write sympy in search-box on the right
  5. Check the package that showed out
  6. Click apply
Share:
35,698
acoustic python
Author by

acoustic python

Updated on January 24, 2020

Comments

  • acoustic python
    acoustic python over 4 years

    I am a beginner to python, I wanted to symbolic computations. I came to know with sympy installation into our pc we can do symbolic computation. I have installed python 3.6 and I am using anaconda nagavitor, through which I am using spyder as an editor. now I want to install symbolic package sympy how to do that. I checked some post which says use 'conda install sympy'. but where to type this? I typed this in spyder editor and I am getting syntax error. thankyou

  • acoustic python
    acoustic python over 5 years
    I could not able to see the apply button
  • acoustic python
    acoustic python over 5 years
    sorry I am a beginer what is git
  • acoustic python
    acoustic python over 5 years
    Its, not showing in my anaconda window. what I have to do
  • acoustic python
    acoustic python over 5 years
    actually I am a windows user . how to do the same in windows
  • pandalai
    pandalai over 5 years
    @acoustic python Did you try "pip3 install sympy"? It also works in Windows.
  • acoustic python
    acoustic python over 5 years
    Finally I got the result. But the code is running in the spyder editor , but not running in the python shell. it is still showing module not found error
  • pandalai
    pandalai over 5 years
    Maybe the package still has not been installed at the path of Python-3.6. Anyway, if you accept my answer, please tick it. Thanks!