Scipy-science python

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.