http://blog.csdn.net/pipisorry/article/details/43277755
Package error introduced in SCIPY:
...
Scipy.misc.imsave (filename, Numpy.kron (doczoom))
...
Attributeerror: ' Module ' object has no attribute ' misc '
Why the error occurred:
Most possibly because scipy are a library (package), contains modules and to import a specific module from the scipy li Brary, need to specify it and import the module itself. As it's a separate module (sub-package), once you import it, it's attributes is available to your by using the regular sci Py.module.attribute.
The modules inside scipy aren ' t accessible as attributes of the base scipy package.
Description of the introduction format
In Python the distinction between what's the public API of a library and Whatare private implementation details are not Always clear. Unlike in otherlanguages like Java, it's possible in Python to access "private" function orobjects. Occasionally this is convenient, but is aware that if you do soyour code could break without warning in the future releases. Some widely understoodrules for what's and isn ' t public in Python was:
- methods/functions/classes and module attributes whose names Beginwith a leadin G underscore is private.
- If A class name begins with a leading underscore none of it members arepublic, whether or not they begin with a Leadi Ng underscore.
- If A module name in a package begins with a leading underscore none ofits members is public, whether or not they begi N with a leadingunderscore.
- If A module or package defines __all__ that authoritatively defines thepublic interface.
- If a module or package doesn ' t define __all__ and all Names that don ' tstart with a leading underscore is public.
Note:reading the above guidelines one could draw the conclusion that Everyprivate module or object starts with an Undersco Re. This is not thecase; The presence of underscores do mark something as private, butthe absence of underscores does not mark something as public.
In Scipy there is modules whose names don ' t start with a underscore, but Thatshould is considered private. To clarify which modules these be we definebelow what's the public API was for Scipy, and give some recommendations for HOWT o Import modules/functions/objects from Scipy.
"Api-importing from Scipy"
Solve:
You need import scipy.misc
to do or from scipy import misc
.
from:http://blog.csdn.net/pipisorry/article/details/43277755
Ref
Scipy-science python