程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了TypeError: 'module' object is not callable 。如何解决这个问题呢大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决TypeError: 'module' object is not callable 。如何解决这个问题呢?

开发过程中遇到TypeError: 'module' object is not callable 。如何解决这个问题呢的问题如何解决?下面主要结合日常开发的经验,给出你关于TypeError: 'module' object is not callable 。如何解决这个问题呢的解决方法建议,希望对你解决TypeError: 'module' object is not callable 。如何解决这个问题呢有所启发或帮助;
y_Train = y_Train.reshape(-1,)

    y_Train[:5]
    
    y_test = y_test.reshape(-1,)
    
    nwclasses= classes
    nwclasses = ["airplane","automobile","bird","cat","deer","dog","frog","horse","ship","truck"]
    def plot_sample(X,y,indeX):
        plt.figure(figsize = (15,2))
        plt.imshow(X[index])
        plt.xlabel(classes[Y[index]]) 
    plot_sample(X_Train,y_Train,1)

**TypeError TraceBACk(最近一次调用最后一次) 在 ----> 1 plot_sample(X_Train,1)

<ipython-input-34-4fb71385cd26> in plot_sample(X,indeX)
      1 def plot_sample(X,indeX):
----> 2     plt.figure(figsize = (15,2))
      3     plt.imshow(X[index])
      4     plt.xlabel(classes[Y[index]])

TypeError: 'module' object is not callable**

解决方法

figure 是 matplotlib 中的一个模块,我们用 figure.Figure 类代替:

import matplotlib
matplotlib.figure.Figure(figsize = (15,2))

大佬总结

以上是大佬教程为你收集整理的TypeError: 'module' object is not callable 。如何解决这个问题呢全部内容,希望文章能够帮你解决TypeError: 'module' object is not callable 。如何解决这个问题呢所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。