No module named scipy.stats - Why, even though scipy is installed

How to use python and scipy to get a random poissio variable? Wow .. I installed scipy, and for the documents I received, there is no module called scipy.stats? I'm on ubuntu 12.04. So ... go figure

http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.poisson.html

ubuntu@ubuntu:~/Downloads$ sudo apt-get install python-scipy
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-scipy is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 482 not upgraded.
ubuntu@ubuntu:~/Downloads$ python
Python 2.7.3 (default, Apr 10 2013, 06:20:15) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy.stats import poisson
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named scipy.stats
+4
source share
4 answers

I think scipy is the way to go. You probably have a simple namespace visibility issue. since statistics itself is a module that you need to import first, then you can use functions from scipy.stats

import scipy
import scipy.stats
#now you can use
scipy.stats.poisson
#if you want it more accessible you could do what you did above
from scipy.stats import poisson
#then call poisson directly
poisson
+11
source

, "scipy.py". , , " scipy" , , , , :

ImportError: No module named stats

, , !

+1
0

I had a similar problem with Python 3.4 on my windows 7 machine. I had to upgrade my scipy package 'pip install --upgrade scipy'

0
source

All Articles