Generate random values from a distribution in Python

Asked

Viewed 788 times

5

Hello!

I’m trying to generate random values of a distribution (Gamma, normal and etc) in python, but I’m having trouble importing the library. I am using the following library "import scipy.special as sps", but it is giving error... using both Python 2 and Python 3.

Thanks in advance.

  • Which error is being shown?

  • This error: Traceback (Most recent call last): File "<stdin>", line 1, in <module> Import: No module named 'scipy'

4 answers

1

I personally believe the most correct way to import the library would be:

from scipy import special

A similar question can be seen here.
Importing the library as you suggest doesn’t seem possible.

  • Keeps making the same mistake!

  • @user20273 sure you have the module installed?

  • @user20273 If you are using Ubuntu at the command line, try the following: sudo apt-get install python-numpy python-scipy

  • Hi Rui! I use the jaro, I got to install the module and keep giving the same error!

  • @user20273 I’ve never worked with this distribution, but try the following: sudo Pacman -S python-numpy python-scipy

0

Download the numpy module along with the scipy that sure! Go to the terminal and paste or type the line below.

sudo apt-get install python-numpy python-scipy
  • Hello! Download the numpy module together with scipy and still keep giving the same error, both in python 2 and python 3. I believe the problem is in the library I’m using.

0


Since the default for the terminal is python 3, the problem arises that numpy has no support for python 3. So one solution I had is to use python 2 and install the modules: python2-numpy python2-scipy.

So sure.

0

You need to download the module in order to use it.

Type in the terminal (or cmd)

pip install scipy

Browser other questions tagged

You are not signed in. Login or sign up in order to post.