[Tutor] computation library

Steven D'Aprano steve at pearwood.info
Fri May 29 08:16:38 CEST 2015


On Thu, May 28, 2015 at 04:26:26PM -0600, Yongnuan Liu wrote:
> Hi Everyone,
> 
> I am new to Python. I just downloaded Python 2.7.10.  I am very frustrated
> on starting programming. Here are some questions which I hope you can help
> me with?
> 
> 1. Could someone recommend me a more user friendly python debugging tool?

The simplest debugging tool possible is print.

x = 23
print x  # What's the value of x?


> 2. Where to download the computing/plotting library, like scipy etc? For
> example, when I input a=sin(30), the error says sin is not defined?? it is
> just simple calculation and I cannot do it correctly.

from math import sin
a = sin(30)  # 30 radians, are you sure you want that?

import math
b = math.sins(math.radians(30))


What operating system are you using? If you are using Linux, you should 
be able to get scipy from your OS's package manager. At the shell 
prompt, this should work on Linux based systems:

$ sudo yum install scipy numpy

and this should work on Debian based systems:

$ sudo aptitude install scipy numpy

On Windows, there is no package manager, so you will have to go to the 
scipy website and download from there. But you may need a C or Fortran 
compiler, which most Windows users don't have, so better is to use a 
pre-packaged system, e.g. Anaconda:

http://continuum.io/downloads

If you have used Mathematica or another "notebook" based system, you 
might like iPython:

http://ipython.org/install.html



> 3. How to set up variable enviroment before using these libraries?

I don't understand this question. Can you explain in more detail?


-- 
Steve


More information about the Tutor mailing list