Python's random module made inaccessible by Numpy's random module Python's random module made inaccessible by Numpy's random module numpy numpy

Python's random module made inaccessible by Numpy's random module


Sounds like you have something like

import randomfrom numpy import *

and random is getting clobbered by the numpy import. If you want to keep the import * then you'll need to rename random:

import random as rnd    # or whatever name you likefrom numpy import *

Alternatively, and probably better, is to import numpy as a module instead of just yanking it all into your module's namespace:

import randomimport numpy as np      # or leave as numpy, or whatever name you like


This shouldn't happen. Check your code for bad imports like from numpy import *.


Be sure to keep the imports distinct:

>>> import numpy.random>>> import random         # python's random